Class Type1Font

    • Field Detail

      • characterSet

        private java.lang.String characterSet
      • kernPairs

        private java.util.Map<java.lang.Long,​java.lang.Integer> kernPairs
        Represents the section KernPairs in the AFM file. Key is uni1 << 32 + uni2. Value is kerning value.
      • PFB_TYPES

        private static final int[] PFB_TYPES
        Types of records in a PFB file. ASCII is 1 and BINARY is 2. They have to appear in the PFB file in this sequence.
      • fontStreamBytes

        private byte[] fontStreamBytes
      • fontStreamLengths

        private int[] fontStreamLengths
    • Constructor Detail

      • Type1Font

        protected Type1Font()
      • Type1Font

        protected Type1Font​(java.lang.String metricsPath,
                            java.lang.String binaryPath,
                            byte[] afm,
                            byte[] pfb)
                     throws java.io.IOException
        Throws:
        java.io.IOException
      • Type1Font

        protected Type1Font​(java.lang.String baseFont)
    • Method Detail

      • createStandardFont

        protected static Type1Font createStandardFont​(java.lang.String name)
                                               throws java.io.IOException
        Throws:
        java.io.IOException
      • initializeGlyphs

        public void initializeGlyphs​(FontEncoding fontEncoding)
        Fills missing character codes in codeToGlyph map.
        Parameters:
        fontEncoding - to be used to map unicode values to character codes.
      • isBuiltInFont

        public boolean isBuiltInFont()
      • getCharacterSet

        public java.lang.String getCharacterSet()
      • hasKernPairs

        public boolean hasKernPairs()
        Checks if the font has any kerning pairs.
        Overrides:
        hasKernPairs in class FontProgram
        Returns:
        true if the font has any kerning pairs.
      • getKerning

        public int getKerning​(Glyph first,
                              Glyph second)
        Description copied from class: FontProgram
        Gets the kerning between two glyphs.
        Specified by:
        getKerning in class FontProgram
        Parameters:
        first - the first glyph
        second - the second glyph
        Returns:
        the kerning to be applied
      • setKerning

        public boolean setKerning​(int first,
                                  int second,
                                  int kern)
        Sets the kerning between two Unicode chars.
        Parameters:
        first - the first unicode char.
        second - the second unicode char.
        kern - the kerning to apply in normalized 1000 units.
        Returns:
        true if the kerning was applied, false otherwise.
      • getGlyph

        public Glyph getGlyph​(java.lang.String name)
        Find glyph by glyph name.
        Parameters:
        name - Glyph name
        Returns:
        Glyph instance if found, otherwise null.
      • getFontStreamBytes

        public byte[] getFontStreamBytes()
      • getFontStreamLengths

        public int[] getFontStreamLengths()
      • isBuiltWith

        public boolean isBuiltWith​(java.lang.String fontProgram)
        Description copied from class: FontProgram
        Checks whether the FontProgram was built with corresponding fontName. Default value is false unless overridden.
        Overrides:
        isBuiltWith in class FontProgram
        Parameters:
        fontProgram - a font name or path to a font program
        Returns:
        true, if the FontProgram was built with the fontProgram. Otherwise false.
      • process

        protected void process()
                        throws java.io.IOException
        Throws:
        java.io.IOException