sk.upjs.fontmapper
Class GlyphDataWriter

java.lang.Object
  extended by sk.upjs.fontmapper.GlyphDataWriter
Direct Known Subclasses:
GlyphDataWriterDefault

abstract class GlyphDataWriter
extends java.lang.Object

Base class for classes handling glyph data output.


Nested Class Summary
protected  class GlyphDataWriter.GlyphData
          Stores output data for single glyph.
 
Field Summary
protected  boolean antialiasing_
          Antialiasing mode.
protected  GlyphDataWriter.GlyphData currentGlyph_
          GlyphData that is currently written to.
protected  java.lang.String fontName_
          Name of the font.
protected  int fontSize_
          Point size of the font.
protected  int fontStyle_
          Style of the font (e.g.
protected  java.util.ArrayList<java.util.ArrayList<GlyphDataWriter.GlyphData>> glyphs_
          GlyphData of all glyphs in all pages.
protected  int numGlyphs_
          Number of glyphs.
protected  int numPages_
          Number of texture pages.
protected  int pageFormat_
          Color format of texture pages.
protected  java.util.ArrayList<java.lang.String> pageNames_
          File names of texture pages.
protected  java.awt.Dimension pageSize_
          Size of texture pages in pixels.
protected  int startGlyph_
          First glyph drawn.
 
Constructor Summary
GlyphDataWriter()
          Constructor.
 
Method Summary
 void fontData(java.lang.String fontName, int fontSize, int fontStyle, boolean antialiasing)
          Set font metadata to output.
 void glyphData(int startGlyph, int numGlyphs)
          Set metadata about all glyphs to output.
 void glyphFinish()
          Finish adding a glyph.
 void glyphMetrics(java.awt.Point offset, int advance, java.awt.Dimension size)
          Set glyph metrics of the glyph currently being added.
 void glyphTexCoords(java.awt.geom.Rectangle2D.Float texcoords)
          Set texture coordinates of the glyph currently being added.
 void pageData(int numPages, java.awt.Dimension pageSize, int pageFormat)
          Set font texture page metadata to output.
 void pageFinish(java.lang.String name)
          Finish a texture page and set its filename.
abstract  void write(java.lang.String fileName)
          Write out to specified file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

fontName_

protected java.lang.String fontName_
Name of the font.


fontSize_

protected int fontSize_
Point size of the font.


fontStyle_

protected int fontStyle_
Style of the font (e.g. bold or italic).


antialiasing_

protected boolean antialiasing_
Antialiasing mode.


startGlyph_

protected int startGlyph_
First glyph drawn.


numGlyphs_

protected int numGlyphs_
Number of glyphs.


numPages_

protected int numPages_
Number of texture pages.


pageSize_

protected java.awt.Dimension pageSize_
Size of texture pages in pixels.


pageFormat_

protected int pageFormat_
Color format of texture pages.


pageNames_

protected java.util.ArrayList<java.lang.String> pageNames_
File names of texture pages.


currentGlyph_

protected GlyphDataWriter.GlyphData currentGlyph_
GlyphData that is currently written to.


glyphs_

protected java.util.ArrayList<java.util.ArrayList<GlyphDataWriter.GlyphData>> glyphs_
GlyphData of all glyphs in all pages.

Constructor Detail

GlyphDataWriter

public GlyphDataWriter()
Constructor. Initializes non-primitive members.

Method Detail

write

public abstract void write(java.lang.String fileName)
                    throws GlyphDataOutputException
Write out to specified file.

Throws:
GlyphDataOutputException - on failure.

fontData

public void fontData(java.lang.String fontName,
                     int fontSize,
                     int fontStyle,
                     boolean antialiasing)
Set font metadata to output.

Parameters:
fontName - Name of the font rendered.
fontSize - Point size of the font.
fontStyle - Style of the font (e.g. bold or italic).
antialiasing - Antialiasing mode of the font.

glyphData

public void glyphData(int startGlyph,
                      int numGlyphs)
Set metadata about all glyphs to output.

Parameters:
startGlyph - First (unicode) glyph drawn.
numGlyphs - Number of glyphs drawn.

pageData

public void pageData(int numPages,
                     java.awt.Dimension pageSize,
                     int pageFormat)
Set font texture page metadata to output.

Parameters:
numPages - Number of texture pages.
pageSize - Size of texture pages in pixels.
pageFormat - Color format of texture pages.

pageFinish

public void pageFinish(java.lang.String name)
Finish a texture page and set its filename.

Parameters:
name - Page filename.

glyphMetrics

public void glyphMetrics(java.awt.Point offset,
                         int advance,
                         java.awt.Dimension size)
Set glyph metrics of the glyph currently being added.

Parameters:
offset - Offset from the pen to the bottom-left corner of the glyph.
advance - Pixels to move the pen after drawing the glyph.
size - Size of the glyph in pixels.

glyphTexCoords

public void glyphTexCoords(java.awt.geom.Rectangle2D.Float texcoords)
Set texture coordinates of the glyph currently being added.

Parameters:
texcoords - Rectangle specifying texcoords of the glyph.

glyphFinish

public void glyphFinish()
Finish adding a glyph.