espresso3d.engine.viewport.text
Class E3DVariableWidthFont
java.lang.Object
espresso3d.engine.base.E3DEngineItem
espresso3d.engine.renderer.base.E3DRenderable
espresso3d.engine.renderer.base.E3DTexturedRenderable
espresso3d.engine.viewport.text.E3DFont
espresso3d.engine.viewport.text.E3DVariableWidthFont
- public class E3DVariableWidthFont
- extends espresso3d.engine.viewport.text.E3DFont
- Author:
- cmoxley
A variable width font is a font that will scale as the window scales (NOT the viewport)
That way, no matter what size the window is, the font will appear to take the same amount of space
|
Constructor Summary |
E3DVariableWidthFont(E3DEngine engine,
java.lang.String fontID,
java.lang.String textureName,
int numColumns,
int numRows)
Construct a variable width font. |
E3DVariableWidthFont(E3DEngine engine,
java.lang.String fontID,
java.lang.String textureName,
int numColumns,
int numRows,
int blendMode)
Construct a variable width font. |
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
E3DVariableWidthFont
public E3DVariableWidthFont(E3DEngine engine,
java.lang.String fontID,
java.lang.String textureName,
int numColumns,
int numRows)
- Construct a variable width font.
- Parameters:
engine - Engine the font will reside infontID - Unique ID for the fonttextureName - Name of the texture (loaded from a textureset) that contains all the symbols for the fontnumColumns - 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 residenumRows - 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
E3DVariableWidthFont
public E3DVariableWidthFont(E3DEngine engine,
java.lang.String fontID,
java.lang.String textureName,
int numColumns,
int numRows,
int blendMode)
- Construct a variable width font.
- Parameters:
engine - Engine the font will reside infontID - Unique ID for the fonttextureName - Name of the texture (loaded from a textureset) that contains all the symbols for the fontnumColumns - 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 residenumRows - 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 resideblendMode - Blending mode of the font
bindSymbolToTexturePosition
public void bindSymbolToTexturePosition(char symbol,
int row,
int column,
int symbolWidthPixels)
- 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
- Parameters:
symbol - A single characterrow - Row in the texture the character residescolumn - Column in the texture the character residessymbolWidthPixels - True number of pixels the symbol is within the row/column box.
This will then be centered in the row/column to read the symbol and will then contain
an exact width of the symbol so each symbol can be different widths (ie: variable width font).
This symbol width can be calculated by hand, but I recommend using hte program BitmapFontBuilder (Search for it)
to do this as it does it all from creating the texture to exporting the symbol widths.
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()