Class Type1CharString

java.lang.Object
org.apache.fontbox.cff.Type1CharString
Direct Known Subclasses:
Type2CharString

public class Type1CharString extends Object
This class represents and renders a Type 1 CharString.
  • Field Details

    • LOG

      private static final org.apache.commons.logging.Log LOG
    • font

      private final Type1CharStringReader font
    • fontName

      private final String fontName
    • glyphName

      private final String glyphName
    • path

      private GeneralPath path
    • width

      private int width
    • leftSideBearing

      private Point2D.Float leftSideBearing
    • current

      private Point2D.Float current
    • isFlex

      private boolean isFlex
    • flexPoints

      private final List<Point2D.Float> flexPoints
    • type1Sequence

      private final List<Object> type1Sequence
    • commandCount

      private int commandCount
  • Constructor Details

    • Type1CharString

      public Type1CharString(Type1CharStringReader font, String fontName, String glyphName, List<Object> sequence)
      Constructs a new Type1CharString object.
      Parameters:
      font - Parent Type 1 CharString font.
      fontName - Name of the font.
      glyphName - Name of the glyph.
      sequence - Type 1 char string sequence
    • Type1CharString

      protected Type1CharString(Type1CharStringReader font, String fontName, String glyphName)
      Constructor for use in subclasses.
      Parameters:
      font - Parent Type 1 CharString font.
      fontName - Name of the font.
      glyphName - Name of the glyph.
  • Method Details

    • getName

      public String getName()
    • getBounds

      public Rectangle2D getBounds()
      Returns the bounds of the renderer path.
      Returns:
      the bounds as Rectangle2D
    • getWidth

      public int getWidth()
      Returns the advance width of the glyph.
      Returns:
      the width
    • getPath

      public GeneralPath getPath()
      Returns the path of the character.
      Returns:
      the path
    • render

      private void render()
      Renders the Type 1 char string sequence to a GeneralPath.
    • handleType1Command

      private void handleType1Command(List<Number> numbers, CharStringCommand command)
    • setCurrentPoint

      private void setCurrentPoint(Number x, Number y)
      Sets the current absolute point without performing a moveto. Used only with results from callothersubr
    • callOtherSubr

      private void callOtherSubr(int num)
      Flex (via OtherSubrs)
      Parameters:
      num - OtherSubrs entry number
    • rmoveTo

      private void rmoveTo(Number dx, Number dy)
      Relative moveto.
    • rlineTo

      private void rlineTo(Number dx, Number dy)
      Relative lineto.
    • rrcurveTo

      private void rrcurveTo(Number dx1, Number dy1, Number dx2, Number dy2, Number dx3, Number dy3)
      Relative curveto.
    • closeCharString1Path

      private void closeCharString1Path()
      Close path.
    • seac

      private void seac(Number asb, Number adx, Number ady, Number bchar, Number achar)
      Standard Encoding Accented Character Makes an accented character from two other characters.
      Parameters:
      asb -
    • addCommand

      protected void addCommand(List<Number> numbers, CharStringCommand command)
      Add a command to the type1 sequence.
      Parameters:
      numbers - the parameters of the command to be added
      command - the command to be added
    • isSequenceEmpty

      protected boolean isSequenceEmpty()
      Indicates if the underlying type1 sequence is empty.
      Returns:
      true if the sequence is empty
    • getLastSequenceEntry

      protected Object getLastSequenceEntry()
      Returns the last entry of the underlying type1 sequence.
      Returns:
      the last entry of the type 1 sequence or null if empty
    • toString

      public String toString()
      Overrides:
      toString in class Object