Package org.apache.fontbox.ttf
Class GlyfSimpleDescript
- java.lang.Object
-
- org.apache.fontbox.ttf.GlyfDescript
-
- org.apache.fontbox.ttf.GlyfSimpleDescript
-
- All Implemented Interfaces:
GlyphDescription
public class GlyfSimpleDescript extends GlyfDescript
This class is based on code from Apache Batik a subproject of Apache XMLGraphics. see http://xmlgraphics.apache.org/batik/ for further details.
-
-
Field Summary
Fields Modifier and Type Field Description private int[]
endPtsOfContours
private byte[]
flags
private static org.apache.commons.logging.Log
LOG
Log instance.private int
pointCount
private short[]
xCoordinates
private short[]
yCoordinates
-
Fields inherited from class org.apache.fontbox.ttf.GlyfDescript
ON_CURVE, REPEAT, X_DUAL, X_SHORT_VECTOR, Y_DUAL, Y_SHORT_VECTOR
-
-
Constructor Summary
Constructors Constructor Description GlyfSimpleDescript(short numberOfContours, TTFDataStream bais, short x0)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getEndPtOfContours(int i)
Returns the index of the ending point of the given contour.byte
getFlags(int i)
Returns the flags of the given point.int
getPointCount()
Returns the number of points.short
getXCoordinate(int i)
Returns the x coordinate of the given point.short
getYCoordinate(int i)
Returns the y coordinate of the given point.boolean
isComposite()
Returns whether this point is a composite or not.private void
readCoords(int count, TTFDataStream bais, short x0)
The table is stored as relative values, but we'll store them as absolutes.private void
readFlags(int flagCount, TTFDataStream bais)
The flags are run-length encoded.-
Methods inherited from class org.apache.fontbox.ttf.GlyfDescript
getContourCount, getInstructions, readInstructions, resolve
-
-
-
-
Constructor Detail
-
GlyfSimpleDescript
GlyfSimpleDescript(short numberOfContours, TTFDataStream bais, short x0) throws java.io.IOException
Constructor.- Parameters:
numberOfContours
- number of contoursbais
- the stream to be readx0
- the initial X-position- Throws:
java.io.IOException
- is thrown if something went wrong
-
-
Method Detail
-
getEndPtOfContours
public int getEndPtOfContours(int i)
Returns the index of the ending point of the given contour.- Parameters:
i
- the number of the contour- Returns:
- the index of the ending point of the given contour
-
getFlags
public byte getFlags(int i)
Returns the flags of the given point. To decode these bit flags, use the static elements ofGlyfDescript
. See also "Outline flags" in The 'glyf' table in the TrueType Reference Manual.- Parameters:
i
- the given point- Returns:
- the flags value for the given point
-
getXCoordinate
public short getXCoordinate(int i)
Returns the x coordinate of the given point.- Parameters:
i
- the given point- Returns:
- the x coordinate value for the given point
-
getYCoordinate
public short getYCoordinate(int i)
Returns the y coordinate of the given point.- Parameters:
i
- the given point- Returns:
- the y coordinate value for the given point
-
isComposite
public boolean isComposite()
Returns whether this point is a composite or not.- Returns:
- true if this point is a composite
-
getPointCount
public int getPointCount()
Returns the number of points.- Returns:
- the number of points
-
readCoords
private void readCoords(int count, TTFDataStream bais, short x0) throws java.io.IOException
The table is stored as relative values, but we'll store them as absolutes.- Throws:
java.io.IOException
-
readFlags
private void readFlags(int flagCount, TTFDataStream bais) throws java.io.IOException
The flags are run-length encoded.- Throws:
java.io.IOException
-
-