<h2>org.das2.util.GrannyTextRenderer</h2><p>Utility class for rendering "Granny" strings, which use the codes
 identified by Grandle and Nystrom in their 1980 paper to provide 
 rich formatting such as new lines and superscripts.  This has been
 extended significantly to include some html support, and extensions
 which paint arbitrary graphics.
 Granny are strings like "E=mc!e2" where the "!e" indicates the pen should be 
 moved to the exponent position before drawing.  This supports sequences
 including:<pre>
 !A  shift up one half line
 !B  shift down one half line  (e.g.  !A3!n-!B4!n is 3/4).
 !C  newline 
 !D  subscript 0.62 of old font size.
 !U  superscript of 0.62 of old font size.
 !E  superscript 0.44 of old font size.
 !I  subscript 0.44 of old font size.
 !N  return to the original font size.
 !R  restore position to last saved position
 !S  save the current position.
 !K  reduce the font size. (Not in IDL's set.)
 !!  the exclamation point (!)
 !(ext;args) where ext can be:
 !(color;saddleBrown)  switch to color.
 !(painter;codeId;codeArg1)  Plug-in Java code for painting regions.
 !(bold) switch to bold
 !(italic) switch to italic
 !(unbold) switch off bold by switching to plain
 !(unitalic) switch off italic by switching to plain
 !(underline) switch to underline
 !(ununderline) switch to underline
 </pre>
 For Greek and math symbols, Unicode characters should be
 used like so: &amp;#9742; (&#9742 phone symbol), or symbols like <tt>&amp;Omega;</tt> and <tt>&amp;omega;</tt>
 
 The GrannyTextRenderer object is created and then the method
 setString is called and layout is performed, in Jython:
 
 <pre>
 def paint(g):
    gtr= GrannyTextRenderer()
    gtr.setString( g, 'E=mc!e2' )
    gtr.draw( g, 0, g.getFont().getHeight() )
 </pre></p>
<h2>GrannyTextRenderer( )</h2>
<p></p>

<hr>
<a name="LEFT_ALIGNMENT"></a>
<h2>LEFT_ALIGNMENT</h2>
<p></p>

<hr>
<a name="CENTER_ALIGNMENT"></a>
<h2>CENTER_ALIGNMENT</h2>
<p></p>

<hr>
<a name="RIGHT_ALIGNMENT"></a>
<h2>RIGHT_ALIGNMENT</h2>
<p></p>

<hr>
<a name="PROP_GLOW"></a>
<h2>PROP_GLOW</h2>
<p></p>

<hr>
<a name="addPainter"></a>
<h2>addPainter</h2>
addPainter( <a href='https://docs.oracle.com/javase/8/docs/api/java/lang/String.html'>String</a> id, <a href='http://www-pw.physics.uiowa.edu/~jbf/autoplot/doc/org/das2/util/GrannyTextRenderer/Painter.html'>org.das2.util.GrannyTextRenderer.Painter</a> p ) &rarr; void

<p>add a painter for the grannyTextRenderer.  This is done by associating
 a Painter code with an id, and the id is used within the annotation string.</p>

<h3>Parameters</h3>
id - id for the painter, where the id is found in the granny text string
<br>
p - the painter code which draws on a graphics context.

<h3>Returns:</h3>
void (returns nothing)

<br><br>
<a href="https://github.com/autoplot/dev/search?q=addPainter&unscoped_q=addPainter">[search for examples]</a>
 <a href="https://github.com/autoplot/documentation/tree/master/javadoc/org/das2/util/GrannyTextRenderer.md">[view on GitHub]</a>
 <a href="http://www-pw.physics.uiowa.edu/~jbf/autoplot/javadoc2018/org/das2/util/GrannyTextRenderer.html#addPainter">[view on old javadoc]</a>
 <a href="https://saturn.physics.uiowa.edu/svn/das2/dasCore/community/autoplot2011/trunk/dasCoreUtil/src/org/das2/util/GrannyTextRenderer.java">[view source]</a>
<br>
<br>
<hr>
<a name="clearPainters"></a>
<h2>clearPainters</h2>
clearPainters(  ) &rarr; void

<p>remove all the painters</p>

<h3>Returns:</h3>
void (returns nothing)

<br><br>
<a href="https://github.com/autoplot/dev/search?q=clearPainters&unscoped_q=clearPainters">[search for examples]</a>
 <a href="https://github.com/autoplot/documentation/tree/master/javadoc/org/das2/util/GrannyTextRenderer.md">[view on GitHub]</a>
 <a href="http://www-pw.physics.uiowa.edu/~jbf/autoplot/javadoc2018/org/das2/util/GrannyTextRenderer.html#clearPainters">[view on old javadoc]</a>
 <a href="https://saturn.physics.uiowa.edu/svn/das2/dasCore/community/autoplot2011/trunk/dasCoreUtil/src/org/das2/util/GrannyTextRenderer.java">[view source]</a>
<br>
<br>
<hr>
<a name="draw"></a>
<h2>draw</h2>
draw( <a href='https://docs.oracle.com/javase/8/docs/api/java/awt/Graphics.html'>java.awt.Graphics</a> ig, float ix, float iy ) &rarr; void

<p>draw the current string.  Note the first line will be above iy, and following lines will
 be below iy.  This is to be consistent with Graphics2D.drawString.</p>

<h3>Parameters</h3>
ig - Graphic object to use to render the text.
<br>
ix - The x position of the first character of text.
<br>
iy - The y position of the baseline of the first line of text.

<h3>Returns:</h3>
void (returns nothing)

<br><br>
<a href="https://github.com/autoplot/dev/search?q=draw&unscoped_q=draw">[search for examples]</a>
 <a href="https://github.com/autoplot/documentation/tree/master/javadoc/org/das2/util/GrannyTextRenderer.md">[view on GitHub]</a>
 <a href="http://www-pw.physics.uiowa.edu/~jbf/autoplot/javadoc2018/org/das2/util/GrannyTextRenderer.html#draw">[view on old javadoc]</a>
 <a href="https://saturn.physics.uiowa.edu/svn/das2/dasCore/community/autoplot2011/trunk/dasCoreUtil/src/org/das2/util/GrannyTextRenderer.java">[view source]</a>
<br>
<br>
<hr>
<a name="getAlignment"></a>
<h2>getAlignment</h2>
getAlignment(  ) &rarr; float

<p>returns the current alignment, by default LEFT_ALIGNMENT.</p>

<h3>Returns:</h3>
the current alignment.
<br><br>
<a href="https://github.com/autoplot/dev/search?q=getAlignment&unscoped_q=getAlignment">[search for examples]</a>
 <a href="https://github.com/autoplot/documentation/tree/master/javadoc/org/das2/util/GrannyTextRenderer.md">[view on GitHub]</a>
 <a href="http://www-pw.physics.uiowa.edu/~jbf/autoplot/javadoc2018/org/das2/util/GrannyTextRenderer.html#getAlignment">[view on old javadoc]</a>
 <a href="https://saturn.physics.uiowa.edu/svn/das2/dasCore/community/autoplot2011/trunk/dasCoreUtil/src/org/das2/util/GrannyTextRenderer.java">[view source]</a>
<br>
<br>
<hr>
<a name="getAscent"></a>
<h2>getAscent</h2>
getAscent(  ) &rarr; double

<p>return the amount that the bounding box will go above the baseline.
 This is also the height of the first line.</p>

<h3>Returns:</h3>
the amount that the bounding box will go above the baseline.
<br><br>
<a href="https://github.com/autoplot/dev/search?q=getAscent&unscoped_q=getAscent">[search for examples]</a>
 <a href="https://github.com/autoplot/documentation/tree/master/javadoc/org/das2/util/GrannyTextRenderer.md">[view on GitHub]</a>
 <a href="http://www-pw.physics.uiowa.edu/~jbf/autoplot/javadoc2018/org/das2/util/GrannyTextRenderer.html#getAscent">[view on old javadoc]</a>
 <a href="https://saturn.physics.uiowa.edu/svn/das2/dasCore/community/autoplot2011/trunk/dasCoreUtil/src/org/das2/util/GrannyTextRenderer.java">[view source]</a>
<br>
<br>
<hr>
<a name="getBounds"></a>
<h2>getBounds</h2>
getBounds(  ) &rarr; <a href='https://docs.oracle.com/javase/8/docs/api/java/awt/Rectangle.html'>java.awt.Rectangle</a>

<p>returns the bounds of the current string.  The lower-left corner of
 the first character will be roughly (0,0), to be compatible with
 FontMetrics.getStringBounds().</p>

<h3>Returns:</h3>
a Rectangle indicating the text boundaries.
<br><br>
<a href="https://github.com/autoplot/dev/search?q=getBounds&unscoped_q=getBounds">[search for examples]</a>
 <a href="https://github.com/autoplot/documentation/tree/master/javadoc/org/das2/util/GrannyTextRenderer.md">[view on GitHub]</a>
 <a href="http://www-pw.physics.uiowa.edu/~jbf/autoplot/javadoc2018/org/das2/util/GrannyTextRenderer.html#getBounds">[view on old javadoc]</a>
 <a href="https://saturn.physics.uiowa.edu/svn/das2/dasCore/community/autoplot2011/trunk/dasCoreUtil/src/org/das2/util/GrannyTextRenderer.java">[view source]</a>
<br>
<br>
<hr>
<a name="getBounds2D"></a>
<h2>getBounds2D</h2>
getBounds2D(  ) &rarr; <a href='https://docs.oracle.com/javase/8/docs/api/java/awt/geom/Rectangle2D.html'>java.awt.geom.Rectangle2D</a>

<p>return a rectangle backed by floating point numbers.</p>

<h3>Returns:</h3>
Rectangle2D.Double
<br><br>
<a href="https://github.com/autoplot/dev/search?q=getBounds2D&unscoped_q=getBounds2D">[search for examples]</a>
 <a href="https://github.com/autoplot/documentation/tree/master/javadoc/org/das2/util/GrannyTextRenderer.md">[view on GitHub]</a>
 <a href="http://www-pw.physics.uiowa.edu/~jbf/autoplot/javadoc2018/org/das2/util/GrannyTextRenderer.html#getBounds2D">[view on old javadoc]</a>
 <a href="https://saturn.physics.uiowa.edu/svn/das2/dasCore/community/autoplot2011/trunk/dasCoreUtil/src/org/das2/util/GrannyTextRenderer.java">[view source]</a>
<br>
<br>
<hr>
<a name="getDescent"></a>
<h2>getDescent</h2>
getDescent(  ) &rarr; double

<p>return the amount that the bounding box will go below the baseline.</p>

<h3>Returns:</h3>
the amount that the bounding box will go below the baseline.
<br><br>
<a href="https://github.com/autoplot/dev/search?q=getDescent&unscoped_q=getDescent">[search for examples]</a>
 <a href="https://github.com/autoplot/documentation/tree/master/javadoc/org/das2/util/GrannyTextRenderer.md">[view on GitHub]</a>
 <a href="http://www-pw.physics.uiowa.edu/~jbf/autoplot/javadoc2018/org/das2/util/GrannyTextRenderer.html#getDescent">[view on old javadoc]</a>
 <a href="https://saturn.physics.uiowa.edu/svn/das2/dasCore/community/autoplot2011/trunk/dasCoreUtil/src/org/das2/util/GrannyTextRenderer.java">[view source]</a>
<br>
<br>
<hr>
<a name="getHeight"></a>
<h2>getHeight</h2>
getHeight(  ) &rarr; double

<p>returns the hieght of the calculated bounding box.</p>

<h3>Returns:</h3>
the height of the bounding box, in pixels.
<br><br>
<a href="https://github.com/autoplot/dev/search?q=getHeight&unscoped_q=getHeight">[search for examples]</a>
 <a href="https://github.com/autoplot/documentation/tree/master/javadoc/org/das2/util/GrannyTextRenderer.md">[view on GitHub]</a>
 <a href="http://www-pw.physics.uiowa.edu/~jbf/autoplot/javadoc2018/org/das2/util/GrannyTextRenderer.html#getHeight">[view on old javadoc]</a>
 <a href="https://saturn.physics.uiowa.edu/svn/das2/dasCore/community/autoplot2011/trunk/dasCoreUtil/src/org/das2/util/GrannyTextRenderer.java">[view source]</a>
<br>
<br>
<hr>
<a name="getLineOneWidth"></a>
<h2>getLineOneWidth</h2>
getLineOneWidth(  ) &rarr; double

<p>returns the width in pixels of the first line.</p>

<h3>Returns:</h3>
the width in pixels of the first line.
<br><br>
<a href="https://github.com/autoplot/dev/search?q=getLineOneWidth&unscoped_q=getLineOneWidth">[search for examples]</a>
 <a href="https://github.com/autoplot/documentation/tree/master/javadoc/org/das2/util/GrannyTextRenderer.md">[view on GitHub]</a>
 <a href="http://www-pw.physics.uiowa.edu/~jbf/autoplot/javadoc2018/org/das2/util/GrannyTextRenderer.html#getLineOneWidth">[view on old javadoc]</a>
 <a href="https://saturn.physics.uiowa.edu/svn/das2/dasCore/community/autoplot2011/trunk/dasCoreUtil/src/org/das2/util/GrannyTextRenderer.java">[view source]</a>
<br>
<br>
<hr>
<a name="getString"></a>
<h2>getString</h2>
getString(  ) &rarr; <a href='https://docs.oracle.com/javase/8/docs/api/java/lang/String.html'>String</a>

<p>return the string.</p>

<h3>Returns:</h3>
a String

<br><br>
<a href="https://github.com/autoplot/dev/search?q=getString&unscoped_q=getString">[search for examples]</a>
 <a href="https://github.com/autoplot/documentation/tree/master/javadoc/org/das2/util/GrannyTextRenderer.md">[view on GitHub]</a>
 <a href="http://www-pw.physics.uiowa.edu/~jbf/autoplot/javadoc2018/org/das2/util/GrannyTextRenderer.html#getString">[view on old javadoc]</a>
 <a href="https://saturn.physics.uiowa.edu/svn/das2/dasCore/community/autoplot2011/trunk/dasCoreUtil/src/org/das2/util/GrannyTextRenderer.java">[view source]</a>
<br>
<br>
<hr>
<a name="getWidth"></a>
<h2>getWidth</h2>
getWidth(  ) &rarr; double

<p>returns the width of the bounding box, in pixels.</p>

<h3>Returns:</h3>
the width of the bounding box, in pixels.
<br><br>
<a href="https://github.com/autoplot/dev/search?q=getWidth&unscoped_q=getWidth">[search for examples]</a>
 <a href="https://github.com/autoplot/documentation/tree/master/javadoc/org/das2/util/GrannyTextRenderer.md">[view on GitHub]</a>
 <a href="http://www-pw.physics.uiowa.edu/~jbf/autoplot/javadoc2018/org/das2/util/GrannyTextRenderer.html#getWidth">[view on old javadoc]</a>
 <a href="https://saturn.physics.uiowa.edu/svn/das2/dasCore/community/autoplot2011/trunk/dasCoreUtil/src/org/das2/util/GrannyTextRenderer.java">[view source]</a>
<br>
<br>
<hr>
<a name="isGlow"></a>
<h2>isGlow</h2>
isGlow(  ) &rarr; boolean

<p></p>

<h3>Returns:</h3>
boolean

<br><br>
<a href="https://github.com/autoplot/dev/search?q=isGlow&unscoped_q=isGlow">[search for examples]</a>
 <a href="https://github.com/autoplot/documentation/tree/master/javadoc/org/das2/util/GrannyTextRenderer.md">[view on GitHub]</a>
 <a href="http://www-pw.physics.uiowa.edu/~jbf/autoplot/javadoc2018/org/das2/util/GrannyTextRenderer.html#isGlow">[view on old javadoc]</a>
 <a href="https://saturn.physics.uiowa.edu/svn/das2/dasCore/community/autoplot2011/trunk/dasCoreUtil/src/org/das2/util/GrannyTextRenderer.java">[view source]</a>
<br>
<br>
<hr>
<a name="lineCount"></a>
<h2>lineCount</h2>
lineCount( <a href='https://docs.oracle.com/javase/8/docs/api/java/lang/String.html'>String</a> s ) &rarr; int

<p>count the number of lines in the string, breaking on "!c" or "&lt;br&gt;", ignoring empty lines at the beginning.</p>

<h3>Parameters</h3>
s - the string

<h3>Returns:</h3>
the number of lines
<br><br>
<a href="https://github.com/autoplot/dev/search?q=lineCount&unscoped_q=lineCount">[search for examples]</a>
 <a href="https://github.com/autoplot/documentation/tree/master/javadoc/org/das2/util/GrannyTextRenderer.md">[view on GitHub]</a>
 <a href="http://www-pw.physics.uiowa.edu/~jbf/autoplot/javadoc2018/org/das2/util/GrannyTextRenderer.html#lineCount">[view on old javadoc]</a>
 <a href="https://saturn.physics.uiowa.edu/svn/das2/dasCore/community/autoplot2011/trunk/dasCoreUtil/src/org/das2/util/GrannyTextRenderer.java">[view source]</a>
<br>
<br>
<hr>
<a name="removePainter"></a>
<h2>removePainter</h2>
removePainter( <a href='https://docs.oracle.com/javase/8/docs/api/java/lang/String.html'>String</a> id ) &rarr; void

<p>remove the painter with the given id.</p>

<h3>Parameters</h3>
id - id for the painter, where the id is found in the granny text string

<h3>Returns:</h3>
void (returns nothing)

<br><br>
<a href="https://github.com/autoplot/dev/search?q=removePainter&unscoped_q=removePainter">[search for examples]</a>
 <a href="https://github.com/autoplot/documentation/tree/master/javadoc/org/das2/util/GrannyTextRenderer.md">[view on GitHub]</a>
 <a href="http://www-pw.physics.uiowa.edu/~jbf/autoplot/javadoc2018/org/das2/util/GrannyTextRenderer.html#removePainter">[view on old javadoc]</a>
 <a href="https://saturn.physics.uiowa.edu/svn/das2/dasCore/community/autoplot2011/trunk/dasCoreUtil/src/org/das2/util/GrannyTextRenderer.java">[view source]</a>
<br>
<br>
<hr>
<a name="setAlignment"></a>
<h2>setAlignment</h2>
setAlignment( float a ) &rarr; void

<p>set the alignment for rendering, one of LEFT_ALIGNMENT  CENTER_ALIGNMENT or RIGHT_ALIGNMENT.</p>

<h3>Parameters</h3>
a - the alignment, one of LEFT_ALIGNMENT  CENTER_ALIGNMENT or RIGHT_ALIGNMENT.

<h3>Returns:</h3>
void (returns nothing)

<br><br>
<a href="https://github.com/autoplot/dev/search?q=setAlignment&unscoped_q=setAlignment">[search for examples]</a>
 <a href="https://github.com/autoplot/documentation/tree/master/javadoc/org/das2/util/GrannyTextRenderer.md">[view on GitHub]</a>
 <a href="http://www-pw.physics.uiowa.edu/~jbf/autoplot/javadoc2018/org/das2/util/GrannyTextRenderer.html#setAlignment">[view on old javadoc]</a>
 <a href="https://saturn.physics.uiowa.edu/svn/das2/dasCore/community/autoplot2011/trunk/dasCoreUtil/src/org/das2/util/GrannyTextRenderer.java">[view source]</a>
<br>
<br>
<hr>
<a name="setGlow"></a>
<h2>setGlow</h2>
setGlow( boolean glow ) &rarr; void

<p></p>

<h3>Parameters</h3>
glow - a boolean

<h3>Returns:</h3>
void (returns nothing)

<br><br>
<a href="https://github.com/autoplot/dev/search?q=setGlow&unscoped_q=setGlow">[search for examples]</a>
 <a href="https://github.com/autoplot/documentation/tree/master/javadoc/org/das2/util/GrannyTextRenderer.md">[view on GitHub]</a>
 <a href="http://www-pw.physics.uiowa.edu/~jbf/autoplot/javadoc2018/org/das2/util/GrannyTextRenderer.html#setGlow">[view on old javadoc]</a>
 <a href="https://saturn.physics.uiowa.edu/svn/das2/dasCore/community/autoplot2011/trunk/dasCoreUtil/src/org/das2/util/GrannyTextRenderer.java">[view source]</a>
<br>
<br>
<hr>
<a name="setString"></a>
<h2><del>setString</del></h2>
Deprecated: use setString( Graphics g, String str ) instead.
setString( <a href='https://docs.oracle.com/javase/8/docs/api/java/awt/Graphics.html'>java.awt.Graphics</a> g, <a href='https://docs.oracle.com/javase/8/docs/api/java/lang/String.html'>String</a> str ) &rarr; void<br>
setString( <a href='https://docs.oracle.com/javase/8/docs/api/java/awt/Font.html'>java.awt.Font</a> font, <a href='https://docs.oracle.com/javase/8/docs/api/java/lang/String.html'>String</a> label ) &rarr; void<br>
<hr>
<a name="toString"></a>
<h2>toString</h2>
toString(  ) &rarr; <a href='https://docs.oracle.com/javase/8/docs/api/java/lang/String.html'>String</a>

<p></p>

<h3>Returns:</h3>
java.lang.String

<br><br>
<a href="https://github.com/autoplot/dev/search?q=toString&unscoped_q=toString">[search for examples]</a>
 <a href="https://github.com/autoplot/documentation/tree/master/javadoc/org/das2/util/GrannyTextRenderer.md">[view on GitHub]</a>
 <a href="http://www-pw.physics.uiowa.edu/~jbf/autoplot/javadoc2018/org/das2/util/GrannyTextRenderer.html#toString">[view on old javadoc]</a>
 <a href="https://saturn.physics.uiowa.edu/svn/das2/dasCore/community/autoplot2011/trunk/dasCoreUtil/src/org/das2/util/GrannyTextRenderer.java">[view source]</a>
<br>
<br>