com.jmex.font3d
Class Font3D

java.lang.Object
  extended by com.jmex.font3d.Font3D
All Implemented Interfaces:
TextFactory

public class Font3D
extends java.lang.Object
implements TextFactory

This class represents a font ready to be used for 3D. Known bugs: - When glyphs are constructed from other glyphs, the shape returned by gv.getGlyphOutline(0); has them all cluddered up. This might be a bug in the VM, and I have no time to fix it, that is why the loading of each glyph has a try-catch-all statement around it.

Author:
emanuel

Field Summary
(package private)  java.awt.Font font
           
(package private)  Glyph3D[] glyph3Ds
           
(package private)  boolean has_alpha_blending
           
(package private)  boolean has_diffuse_material
           
(package private)  Node renderNode
           
 
Constructor Summary
Font3D(java.awt.Font font, double flatness, boolean drawSides, boolean drawFront, boolean drawBack)
           
 
Method Summary
 Text3D createText(java.lang.String text, float size, int flags)
          Method for creating the text from the font.
static Text3D createText(java.lang.String fontname, java.lang.String text, float size, int flags)
          This method will create a peace of 3d text from this font.
 boolean drawBack()
           
 boolean drawFront()
           
 boolean drawSides()
           
 void enableBlendState()
           
 void enableDiffuseMaterial()
           
 double getFlatness()
           
 java.awt.Font getFont()
           
 Glyph3D getGlyph(char c)
           
 Glyph3D[] getGlyphs()
           
 Node getRenderNode()
          This method is used when text wants to render, much like the shared
 boolean isMeshLocked()
           
static void loadFont3D(java.lang.String fontname, java.awt.Font font, double flatness, boolean drawSides, boolean drawFront, boolean drawBack)
          This method loads and caches a font, call this before calls to #createText(String, int).
 void lockMesh()
           
static void unloadFont(java.lang.String fontname)
          Removes a cached Font3D.
 void unlockMesh()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

renderNode

Node renderNode

glyph3Ds

Glyph3D[] glyph3Ds

font

java.awt.Font font

has_alpha_blending

boolean has_alpha_blending

has_diffuse_material

boolean has_diffuse_material
Constructor Detail

Font3D

public Font3D(java.awt.Font font,
              double flatness,
              boolean drawSides,
              boolean drawFront,
              boolean drawBack)
Method Detail

getRenderNode

public Node getRenderNode()
This method is used when text wants to render, much like the shared

Returns:

createText

public Text3D createText(java.lang.String text,
                         float size,
                         int flags)
Method for creating the text from the font. TODO: react on the flags parameter.

Specified by:
createText in interface TextFactory
Parameters:
text -
size -
flags -
Returns:

loadFont3D

public static void loadFont3D(java.lang.String fontname,
                              java.awt.Font font,
                              double flatness,
                              boolean drawSides,
                              boolean drawFront,
                              boolean drawBack)
This method loads and caches a font, call this before calls to #createText(String, int).

Parameters:
fontname -
font -

unloadFont

public static void unloadFont(java.lang.String fontname)
Removes a cached Font3D.

Parameters:
fontname -

createText

public static Text3D createText(java.lang.String fontname,
                                java.lang.String text,
                                float size,
                                int flags)
This method will create a peace of 3d text from this font.

Parameters:
fontname -
text -
size -
Returns:

getGlyph

public Glyph3D getGlyph(char c)

getFont

public java.awt.Font getFont()

getFlatness

public double getFlatness()

drawSides

public boolean drawSides()

drawFront

public boolean drawFront()

drawBack

public boolean drawBack()

getGlyphs

public Glyph3D[] getGlyphs()

isMeshLocked

public boolean isMeshLocked()

unlockMesh

public void unlockMesh()

lockMesh

public void lockMesh()

enableBlendState

public void enableBlendState()

enableDiffuseMaterial

public void enableDiffuseMaterial()