Class GlyfSimple

java.lang.Object
org.loboevolution.pdfview.font.ttf.Glyf
org.loboevolution.pdfview.font.ttf.GlyfSimple

public class GlyfSimple extends Glyf
A single simple glyph in a pdf font.
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    Creates a new instance of a simple glyf
  • Method Summary

    Modifier and Type
    Method
    Description
    short
    getContourEndPoint(int index)
    Get the end point of a given contour
    Get the data in this glyf as a byte buffer.
    byte
    getFlag(int pointIndex)
    Get a given flag
    byte
    getInstruction(int index)
    Get a given instruction
    short
    Get the length of this glyf.
    short
    Get the number of instructions
    short
    Get the number of points in the glyf
    short
    getXCoord(int pointIndex)
    Get a given x coordinate
    short
    getYCoord(int pointIndex)
    Get a given y coordinate
    boolean
    onCurve(int pointIndex)
    Determine whether the given point is on the curve
    protected boolean
    repeat(int pointIndex)
    Determine whether this flag repeats
    protected void
    setContourEndPoints(short[] contourEndPts)
    Set the number of contours in this glyf
    void
    Set the data for this glyf.
    protected void
    setFlags(byte[] flags)
    Set the flags
    protected void
    setInstructions(byte[] instructions)
    Set the instructions
    protected void
    setXCoords(short[] xCoords)
    Set the x coordinates
    protected void
    setYCoords(short[] yCoords)
    Set the x coordinates
    protected 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.

    Methods inherited from class org.loboevolution.pdfview.font.ttf.Glyf

    getGlyf

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • GlyfSimple

      protected GlyfSimple()
      Creates a new instance of a simple glyf
  • Method Details

    • getData

      public ByteBuffer 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 class Glyf
      Returns:
      a ByteBuffer object.
    • setData

      public void setData(ByteBuffer data)
      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 class Glyf
      Parameters:
      data - a ByteBuffer 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.

      Overrides:
      getLength in class Glyf
      Returns:
      a short.
    • getContourEndPoint

      public short getContourEndPoint(int index)
      Get the end point of a given contour
      Parameters:
      index - a Integer object.
      Returns:
      a short.
    • setContourEndPoints

      protected void setContourEndPoints(short[] contourEndPts)
      Set the number of contours in this glyf
      Parameters:
      contourEndPts - an array of
      invalid reference
      short
      objects.
    • getNumInstructions

      public short getNumInstructions()
      Get the number of instructions
      Returns:
      a short.
    • getInstruction

      public byte getInstruction(int index)
      Get a given instruction
      Parameters:
      index - a Integer object.
      Returns:
      a byte.
    • setInstructions

      protected void setInstructions(byte[] instructions)
      Set the instructions
      Parameters:
      instructions - an array of
      invalid reference
      byte
      objects.
    • 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 - a Integer object.
      Returns:
      a byte.
    • onCurve

      public boolean onCurve(int pointIndex)
      Determine whether the given point is on the curve
      Parameters:
      pointIndex - a Integer 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 - a Integer 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 - a Integer object.
      Returns:
      a boolean.
    • repeat

      protected boolean repeat(int pointIndex)
      Determine whether this flag repeats
      Parameters:
      pointIndex - a Integer 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 - a Integer 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 - a Integer object.
      Returns:
      a boolean.
    • setFlags

      protected void setFlags(byte[] flags)
      Set the flags
      Parameters:
      flags - an array of
      invalid reference
      byte
      objects.
    • getXCoord

      public short getXCoord(int pointIndex)
      Get a given x coordinate
      Parameters:
      pointIndex - a Integer object.
      Returns:
      a short.
    • setXCoords

      protected void setXCoords(short[] xCoords)
      Set the x coordinates
      Parameters:
      xCoords - an array of
      invalid reference
      short
      objects.
    • getYCoord

      public short getYCoord(int pointIndex)
      Get a given y coordinate
      Parameters:
      pointIndex - a Integer object.
      Returns:
      a short.
    • setYCoords

      protected void setYCoords(short[] yCoords)
      Set the x coordinates
      Parameters:
      yCoords - an array of
      invalid reference
      short
      objects.