public class GrannyTextRenderer
extends java.lang.Object
!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 (!)For Greek and math symbols, Unicode characters should be used like so: ☎ (☎ phone symbol), or symbols like Ω and ω
| Modifier and Type | Field and Description |
|---|---|
static float |
CENTER_ALIGNMENT |
static float |
LEFT_ALIGNMENT |
static float |
RIGHT_ALIGNMENT |
| Constructor and Description |
|---|
GrannyTextRenderer() |
| Modifier and Type | Method and Description |
|---|---|
void |
draw(java.awt.Graphics ig,
float ix,
float iy)
draw the current string.
|
float |
getAlignment()
returns the current alignment, by default LEFT_ALIGNMENT.
|
double |
getAscent()
return the amount that the bounding box will go above the baseline.
|
java.awt.Rectangle |
getBounds()
returns the bounds of the current string.
|
double |
getDescent()
return the amount that the bounding box will go below the baseline.
|
double |
getHeight()
returns the hieght of the calculated bounding box.
|
double |
getLineOneWidth()
returns the width in pixels of the first line.
|
double |
getWidth()
returns the width of the bounding box, in pixels.
|
void |
setAlignment(float a)
set the alignment for rendering, one of LEFT_ALIGNMENT CENTER_ALIGNMENT or RIGHT_ALIGNMENT.
|
void |
setString(java.awt.Component c,
java.lang.String str)
Deprecated.
use setString( Graphics g, String str ) instead.
|
void |
setString(java.awt.Font font,
java.lang.String label)
reset the current string for the GTR to draw, calculating the boundaries
of the string.
|
void |
setString(java.awt.Graphics g,
java.lang.String str)
reset the current string for the GTR to draw, calculating the boundaries
of the string.
|
java.lang.String |
toString() |
public static final float LEFT_ALIGNMENT
public static final float CENTER_ALIGNMENT
public static final float RIGHT_ALIGNMENT
public java.awt.Rectangle getBounds()
java.lang.IllegalArgumentException - if the string has not been set.public double getWidth()
java.lang.IllegalArgumentException - if the string has not been set.public double getLineOneWidth()
java.lang.IllegalArgumentException - if the string has not been set.public double getHeight()
java.lang.IllegalArgumentException - if the string has not been set.public double getAscent()
java.lang.IllegalArgumentException - if the string has not been set.public double getDescent()
java.lang.IllegalArgumentException - if the string has not been set.public void setString(java.awt.Component c,
java.lang.String str)
c - the component which will provide the graphics.str - the granny string, such as "E=mc!e2"public void setString(java.awt.Graphics g,
java.lang.String str)
g - the graphics context which will supply the FontMetrics.str - the granny string, such as "E=mc!e2"public void setString(java.awt.Font font,
java.lang.String label)
font - the font. This should be consistent
with the Font used when drawing.label - the granny string, such as "E=mc!e2"public float getAlignment()
public void setAlignment(float a)
a - the alignment, one of LEFT_ALIGNMENT CENTER_ALIGNMENT or RIGHT_ALIGNMENT.public void draw(java.awt.Graphics ig,
float ix,
float iy)
ig - Graphic object to use to render the text.ix - The x position of the first character of text.iy - The y position of the baseline of the first line of text.public java.lang.String toString()
toString in class java.lang.Object