Class CIDFontType2


public class CIDFontType2 extends TTFFont
a font object derived from a CID font.
  • Field Details

    • widths

      private Map<Character,Float> widths
      The width of each glyph from the DW and W arrays
    • widthsVertical

      private Map<Character,Float> widthsVertical
      The vertical width of each glyph from the DW2 and W2 arrays
    • defaultWidth

      private int defaultWidth
    • defaultWidthVertical

      private int defaultWidthVertical
    • cidToGidMap

      private ByteBuffer cidToGidMap
      the CIDtoGID map, if any
  • Constructor Details

    • CIDFontType2

      public CIDFontType2(String baseName, PDFObject fontObj, PDFFontDescriptor descriptor) throws IOException
      create a new CIDFontType2 object based on the name of a built-in font and the font descriptor
      Parameters:
      baseName - the name of the font, from the PDF file
      fontObj - a dictionary that contains the DW (defaultWidth) and W (width) parameters
      descriptor - a descriptor for the font
      Throws:
      IOException
  • Method Details

    • parseWidths

      private void parseWidths(PDFObject fontObj) throws IOException
      Parse the Widths array and DW object
      Throws:
      IOException
    • getDefaultWidth

      public int getDefaultWidth()
      Get the default width in text space
      Overrides:
      getDefaultWidth in class OutlineFont
    • getWidth

      public float getWidth(char code, String name)
      Get the width of a given character
      Overrides:
      getWidth in class OutlineFont
    • getDefaultWidthVertical

      public int getDefaultWidthVertical()
      Get the default vertical width in text space
    • getWidthVertical

      public float getWidthVertical(char code, String name)
      Get the vertical width of a given character
    • getOutline

      protected GeneralPath getOutline(char src, float width)
      Get the outline of a character given the character code. We interpose here in order to avoid using the CMap of the font in a CID mapped font.
      Overrides:
      getOutline in class TTFFont
      Parameters:
      src - the character code of the desired glyph
      Returns:
      the glyph outline