Class GlyfSimple
java.lang.Object
org.loboevolution.pdfview.font.ttf.Glyf
org.loboevolution.pdfview.font.ttf.GlyfSimple
A single simple glyph in a pdf font.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionshort
getContourEndPoint
(int index) Get the end point of a given contourgetData()
Get the data in this glyf as a byte buffer.byte
getFlag
(int pointIndex) Get a given flagbyte
getInstruction
(int index) Get a given instructionshort
Get the length of this glyf.short
Get the number of instructionsshort
Get the number of points in the glyfshort
getXCoord
(int pointIndex) Get a given x coordinateshort
getYCoord
(int pointIndex) Get a given y coordinateboolean
onCurve
(int pointIndex) Determine whether the given point is on the curveprotected boolean
repeat
(int pointIndex) Determine whether this flag repeatsprotected void
setContourEndPoints
(short[] contourEndPts) Set the number of contours in this glyfvoid
setData
(ByteBuffer data) Set the data for this glyf.protected void
setFlags
(byte[] flags) Set the flagsprotected void
setInstructions
(byte[] instructions) Set the instructionsprotected void
setXCoords
(short[] xCoords) Set the x coordinatesprotected void
setYCoords
(short[] yCoords) Set the x coordinatesprotected boolean
xIsByte
(int pointIndex) Determine whether the x value for the given point is byte or short.protected boolean
xIsSame
(int pointIndex) Determine whether the x value for the given point is the same as the previous value.protected boolean
yIsByte
(int pointIndex) Determine whether the x value for the given point is byte or short.protected boolean
yIsSame
(int pointIndex) Determine whether the y value for the given point is the same as the previous value.
-
Constructor Details
-
GlyfSimple
protected GlyfSimple()Creates a new instance of a simple glyf
-
-
Method Details
-
getData
Get the data in this glyf as a byte buffer. Return the basic glyf data only, since there is no specific data. This method returns the data un-flipped, so subclasses can simply append to the allocated buffer.Get the data in this glyf as a byte buffer. Return the basic glyf data only, since there is no specific data. This method returns the data un-flipped, so subclasses can simply append to the allocated buffer.
- Overrides:
getData
in classGlyf
- Returns:
- a
ByteBuffer
object.
-
setData
Set the data for this glyf. Do nothing, since a glyf with no contours has no glyf data.Set the data for this glyf.
- Overrides:
setData
in classGlyf
- Parameters:
data
- aByteBuffer
object.
-
getLength
public short getLength()Get the length of this glyf. A glyf with no data has a length of 10 (2 bytes each for 5 short values)Get the length of this glyf.
-
getContourEndPoint
public short getContourEndPoint(int index) Get the end point of a given contour- Parameters:
index
- aInteger
object.- Returns:
- a short.
-
setContourEndPoints
protected void setContourEndPoints(short[] contourEndPts) Set the number of contours in this glyf- Parameters:
contourEndPts
- an array ofinvalid reference
short
-
getNumInstructions
public short getNumInstructions()Get the number of instructions- Returns:
- a short.
-
getInstruction
public byte getInstruction(int index) Get a given instruction- Parameters:
index
- aInteger
object.- Returns:
- a byte.
-
setInstructions
protected void setInstructions(byte[] instructions) Set the instructions- Parameters:
instructions
- an array ofinvalid reference
byte
-
getNumPoints
public short getNumPoints()Get the number of points in the glyf- Returns:
- a short.
-
getFlag
public byte getFlag(int pointIndex) Get a given flag- Parameters:
pointIndex
- aInteger
object.- Returns:
- a byte.
-
onCurve
public boolean onCurve(int pointIndex) Determine whether the given point is on the curve- Parameters:
pointIndex
- aInteger
object.- Returns:
- a boolean.
-
xIsByte
protected boolean xIsByte(int pointIndex) Determine whether the x value for the given point is byte or short. If true, it is a byte, if false it is a short- Parameters:
pointIndex
- aInteger
object.- Returns:
- a boolean.
-
yIsByte
protected boolean yIsByte(int pointIndex) Determine whether the x value for the given point is byte or short. If true, it is a byte, if false it is a short- Parameters:
pointIndex
- aInteger
object.- Returns:
- a boolean.
-
repeat
protected boolean repeat(int pointIndex) Determine whether this flag repeats- Parameters:
pointIndex
- aInteger
object.- Returns:
- a boolean.
-
xIsSame
protected boolean xIsSame(int pointIndex) Determine whether the x value for the given point is the same as the previous value.- Parameters:
pointIndex
- aInteger
object.- Returns:
- a boolean.
-
yIsSame
protected boolean yIsSame(int pointIndex) Determine whether the y value for the given point is the same as the previous value.- Parameters:
pointIndex
- aInteger
object.- Returns:
- a boolean.
-
setFlags
protected void setFlags(byte[] flags) Set the flags- Parameters:
flags
- an array ofinvalid reference
byte
-
getXCoord
public short getXCoord(int pointIndex) Get a given x coordinate- Parameters:
pointIndex
- aInteger
object.- Returns:
- a short.
-
setXCoords
protected void setXCoords(short[] xCoords) Set the x coordinates- Parameters:
xCoords
- an array ofinvalid reference
short
-
getYCoord
public short getYCoord(int pointIndex) Get a given y coordinate- Parameters:
pointIndex
- aInteger
object.- Returns:
- a short.
-
setYCoords
protected void setYCoords(short[] yCoords) Set the x coordinates- Parameters:
yCoords
- an array ofinvalid reference
short
-