Class TTFGlyph2D

  • All Implemented Interfaces:
    Glyph2D

    final class TTFGlyph2D
    extends java.lang.Object
    implements Glyph2D
    This class provides a glyph to GeneralPath conversion for TrueType and OpenType fonts.
    • Field Detail

      • LOG

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

        private final PDFont font
      • scale

        private float scale
      • hasScaling

        private boolean hasScaling
      • glyphs

        private final java.util.Map<java.lang.Integer,​java.awt.geom.GeneralPath> glyphs
      • isCIDFont

        private final boolean isCIDFont
    • Constructor Detail

      • TTFGlyph2D

        TTFGlyph2D​(PDTrueTypeFont ttfFont)
            throws java.io.IOException
        Constructor.
        Parameters:
        ttfFont - TrueType font
        Throws:
        java.io.IOException
      • TTFGlyph2D

        TTFGlyph2D​(PDType0Font type0Font)
            throws java.io.IOException
        Constructor.
        Parameters:
        type0Font - Type0 font, with CIDFontType2 descendant
        Throws:
        java.io.IOException
      • TTFGlyph2D

        private TTFGlyph2D​(TrueTypeFont ttf,
                           PDFont font,
                           boolean isCIDFont)
                    throws java.io.IOException
        Throws:
        java.io.IOException
    • Method Detail

      • getPathForCharacterCode

        public java.awt.geom.GeneralPath getPathForCharacterCode​(int code)
                                                          throws java.io.IOException
        Description copied from interface: Glyph2D
        Returns the path describing the glyph for the given character code.
        Specified by:
        getPathForCharacterCode in interface Glyph2D
        Parameters:
        code - the character code
        Returns:
        the GeneralPath for the given character code
        Throws:
        java.io.IOException
      • getGIDForCharacterCode

        private int getGIDForCharacterCode​(int code)
                                    throws java.io.IOException
        Throws:
        java.io.IOException
      • getPathForGID

        public java.awt.geom.GeneralPath getPathForGID​(int gid,
                                                       int code)
                                                throws java.io.IOException
        Returns the path describing the glyph for the given glyphId.
        Parameters:
        gid - the GID
        code - the character code
        Returns:
        the GeneralPath for the given glyphId
        Throws:
        java.io.IOException
      • dispose

        public void dispose()
        Description copied from interface: Glyph2D
        Remove all cached resources.
        Specified by:
        dispose in interface Glyph2D