Class FontSupport


  • public class FontSupport
    extends java.lang.Object
    some constants and utility functions for font support.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static int[] isoLatin1Encoding
      character mapping from values to glyphs for the isoLatin1Encoding
      static java.lang.String[] macExtras
      extra names for the Macintosh glyph set.
      static int[] macRomanEncoding
      character mapping from values to glyphs for the Macintosh MacRoman encoding
      static int[] standardEncoding
      character mapping from values to glyphs for Adobe's standard character encoding
      static java.lang.String[] stdNames
      names for glyphs in the standard Adobe order.
      (package private) static java.lang.String[] stdValues
      characters for glyphs in the standard order.
      static int[] type1CExpertCharset
      glyph order of the glyphs for the Type1C Expert character set.
      static int[] type1CExpertSubCharset
      glyph order of the glyphs for the Type1C Expert Sub character set.
      static int[] winAnsiEncoding
      character mapping from values to glyphs for the Windows winAnsi character encoding
    • Constructor Summary

      Constructors 
      Constructor Description
      FontSupport()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static int findName​(java.lang.String name, int[] table)
      get the encoding value of a glyph given its name and a charset.
      static int findName​(java.lang.String name, java.lang.String[] table)
      get the encoding value a glyph given its name and a name table.
      static java.lang.String getName​(int i)
      get the name of a glyph from its encoding value (NOT the character value), using the standard encoding.
      static int getStrIndex​(java.lang.String name)
      get the encoding value of a glyph given its name, in the standard charset.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • stdNames

        public static final java.lang.String[] stdNames
        names for glyphs in the standard Adobe order. This is the ordering of the glyphs in a font, not the mapping of character number to character.
      • stdValues

        static final java.lang.String[] stdValues
        characters for glyphs in the standard order. These are string "values" to go with the names in stdNames. Not all glyphs have been translated to their unicode values. In many cases, the name of the glyph has been appended to an ASCII approximation of the glyph. Strings longer than 3 characters have this characteristic. To get the character, use the string if it contains 3 or fewer characters; otherwise, grab the first character off the string and use that.
      • type1CExpertCharset

        public static final int[] type1CExpertCharset
        glyph order of the glyphs for the Type1C Expert character set. These are indices into the glyph name array.
      • type1CExpertSubCharset

        public static final int[] type1CExpertSubCharset
        glyph order of the glyphs for the Type1C Expert Sub character set. These are indices into the glyph name array.
      • macExtras

        public static final java.lang.String[] macExtras
        extra names for the Macintosh glyph set. This array should be considered to be appended to the stdNames array. The stdValues array already contains values for this set.
      • macRomanEncoding

        public static final int[] macRomanEncoding
        character mapping from values to glyphs for the Macintosh MacRoman encoding
      • isoLatin1Encoding

        public static final int[] isoLatin1Encoding
        character mapping from values to glyphs for the isoLatin1Encoding
      • winAnsiEncoding

        public static final int[] winAnsiEncoding
        character mapping from values to glyphs for the Windows winAnsi character encoding
      • standardEncoding

        public static final int[] standardEncoding
        character mapping from values to glyphs for Adobe's standard character encoding
    • Constructor Detail

      • FontSupport

        public FontSupport()
    • Method Detail

      • getName

        public static java.lang.String getName​(int i)
        get the name of a glyph from its encoding value (NOT the character value), using the standard encoding.
      • findName

        public static int findName​(java.lang.String name,
                                   java.lang.String[] table)
        get the encoding value a glyph given its name and a name table.
        Parameters:
        name - the name of the glyph
        table - the charset as an array of names
        Returns:
        the index of the name in the table, or -1 if the name cannot be found in the table
      • findName

        public static int findName​(java.lang.String name,
                                   int[] table)
        get the encoding value of a glyph given its name and a charset.
        Parameters:
        name - the name of the glyph
        table - the charset table
        Returns:
        the index of the name in the charset.
      • getStrIndex

        public static int getStrIndex​(java.lang.String name)
        get the encoding value of a glyph given its name, in the standard charset. This is equivalent to findName(name, FontSupport.stdNames).
        Parameters:
        name - the name of the glyph
        Returns:
        the index of the name in stdNames, or -1 if the name doesn't appear in stdNames.