|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sourceforge.olduvai.accordiondrawer.FontWrapper
public class FontWrapper
This is a wrapper to the jFTGL library intended to present an interface compatible with the older BitmapFont library. Once the jFTGL library API has stabilized, this class may disappear in favor of direct calls. It also caches generated font types & sizes so they don't need to be regenerated.
Field Summary | |
---|---|
private AccordionDrawer |
ad
Accordion drawer that uses this font wrapper. |
private java.util.HashMap<java.awt.Font,com.sun.opengl.util.j2d.TextRenderer> |
fontTable
Table to cache font information; previously created font rendering objects (TextRenderer) are stored according to their Font object. |
Constructor Summary | |
---|---|
FontWrapper(AccordionDrawer ad)
Font wrapper constructor. |
Method Summary | |
---|---|
private com.sun.opengl.util.j2d.TextRenderer |
checkCreateFont(java.awt.Font font)
Create a font renderer. |
void |
drawString(javax.media.opengl.GL gl,
java.awt.geom.Point2D pos,
double zPlane,
java.lang.String text,
java.awt.Font font,
java.awt.Color color)
Draw the text string at the given location. |
int |
getDescent(java.lang.String text,
java.awt.Font f)
Get the descent (number of pixels below the baseline) of the string in pixels. |
int |
stringHeight(java.lang.String text,
java.awt.Font font)
Get the height of the string in pixels. |
int |
stringWidth(java.lang.String text,
java.awt.Font font)
Get the width of the string in pixels. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private java.util.HashMap<java.awt.Font,com.sun.opengl.util.j2d.TextRenderer> fontTable
private AccordionDrawer ad
Constructor Detail |
---|
public FontWrapper(AccordionDrawer ad)
ad
- Drawer that is associated with this font wrapper.Method Detail |
---|
private com.sun.opengl.util.j2d.TextRenderer checkCreateFont(java.awt.Font font)
font
- Font to check or create.
public int stringWidth(java.lang.String text, java.awt.Font font)
text
- Series of characters to get width.font
- Font the characters are drawn in.
public int stringHeight(java.lang.String text, java.awt.Font font)
text
- Series of characters to get height.font
- Font the characters are drawn in.
public int getDescent(java.lang.String text, java.awt.Font f)
text
- Series of characters to get descent.f
- Font the characters are drawn in.
public void drawString(javax.media.opengl.GL gl, java.awt.geom.Point2D pos, double zPlane, java.lang.String text, java.awt.Font font, java.awt.Color color)
gl
- GL contextpos
- 2D Location to place the text in world coordinatestext
- Text to be renderedzPlane
- Vertical plane to use for this font (determines visibility, should be over all drawn objects)font
- Font object to usecolor
- Color for this string
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |