espresso3d.engine.viewport.text
Class E3DFixedWidthFont

java.lang.Object
  extended byespresso3d.engine.base.E3DEngineItem
      extended byespresso3d.engine.renderer.base.E3DRenderable
          extended byespresso3d.engine.renderer.base.E3DTexturedRenderable
              extended byespresso3d.engine.viewport.text.E3DFont
                  extended byespresso3d.engine.viewport.text.E3DFixedWidthFont

public class E3DFixedWidthFont
extends espresso3d.engine.viewport.text.E3DFont

Author:
cmoxley A fixed with font is a font that has even spacing between all characters A texture is divided into a grid of (numColumns x numRows) and each portion of the grid will be 1 symbol. Symbols are then bound to a column/row.

Constructor Summary
E3DFixedWidthFont(E3DEngine engine, java.lang.String fontID, java.lang.String textureName, int numColumns, int numRows)
          Instantiate a fixed width font.
E3DFixedWidthFont(E3DEngine engine, java.lang.String fontID, java.lang.String textureName, int numColumns, int numRows, int blendMode)
          Instantiate a fixed width font.
 
Method Summary
 void bindSymbolToTexturePosition(char symbol, int row, int column)
          This binds a symbol (a single letter, number, etc) to a certain position on this fonts texture.
 java.util.HashMap getCharSymbolMapping()
           
 java.lang.String getFontID()
           
 espresso3d.engine.viewport.text.E3DSymbol getFontSymbol(char symbol)
           
 int getGlTextureID()
           
 int getNumColumns()
           
 int getNumRows()
           
 void render()
           
 void setFontID(java.lang.String fontID)
           
 void setGlTextureID(int glTextureID)
           
 void unbindSymbolFromTexture(char symbol)
           
 
Methods inherited from class espresso3d.engine.renderer.base.E3DTexturedRenderable
getKey, getTexture, getTextureDetail0, getTextureDetail1, isTextureAvailable, isTextureDetail0Available, isTextureDetail1Available, setTexture, setTextureDetail0, setTextureDetail1
 
Methods inherited from class espresso3d.engine.renderer.base.E3DRenderable
getBlendMode, getRenderMode, initCorrectGeometryRenderer, isKeyChanged, setBlendMode, setKeyChanged, setRenderMode
 
Methods inherited from class espresso3d.engine.base.E3DEngineItem
getEngine, setEngine
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

E3DFixedWidthFont

public E3DFixedWidthFont(E3DEngine engine,
                         java.lang.String fontID,
                         java.lang.String textureName,
                         int numColumns,
                         int numRows)
Instantiate a fixed width font.

Parameters:
engine - Engine the font will reside in
fontID - Unique ID for the font
textureName - Name of the texture (loaded from a textureset) that contains all the symbols for the font
numColumns - Number of columns in the texture. This will divide the texture up evenly into numColumns and use the space in-between the columns as the place the symbols will reside
numRows - Number of rows in the texture. This will divide the texture up evenly into numRows and use the space in-between the rows as the place the symbols will reside

E3DFixedWidthFont

public E3DFixedWidthFont(E3DEngine engine,
                         java.lang.String fontID,
                         java.lang.String textureName,
                         int numColumns,
                         int numRows,
                         int blendMode)
Instantiate a fixed width font.

Parameters:
engine - Engine the font will reside in
fontID - Unique ID for the font
textureName - Name of the texture (loaded from a textureset) that contains all the symbols for the font
numColumns - Number of columns in the texture. This will divide the texture up evenly into numColumns and use the space in-between the columns as the place the symbols will reside
numRows - Number of rows in the texture. This will divide the texture up evenly into numRows and use the space in-between the rows as the place the symbols will reside
blendMode - Type of blending to use for the font
Method Detail

bindSymbolToTexturePosition

public void bindSymbolToTexturePosition(char symbol,
                                        int row,
                                        int column)
This binds a symbol (a single letter, number, etc) to a certain position on this fonts texture. That position will be where the engine looks on the texture when the symbol is passed into a viewport print statement. Row/Column starts in the upper left hand corner of the texture image with row=1, column=1. For example, row=1 col=1 would give you the portion of the texture starting in the upper left hand corner and extending right symbolWidths pixels and extending down symbolHeights pixels. row=1, col=2 would have an upper left corner starting at symbolWidth + 1 and extending to symbolWidth * 2 and symbolHeight


getFontSymbol

public espresso3d.engine.viewport.text.E3DSymbol getFontSymbol(char symbol)

unbindSymbolFromTexture

public void unbindSymbolFromTexture(char symbol)

getFontID

public java.lang.String getFontID()

setFontID

public void setFontID(java.lang.String fontID)

getGlTextureID

public int getGlTextureID()

setGlTextureID

public void setGlTextureID(int glTextureID)

render

public void render()
Specified by:
render in class E3DRenderable

getCharSymbolMapping

public java.util.HashMap getCharSymbolMapping()

getNumColumns

public int getNumColumns()

getNumRows

public int getNumRows()