Class OpenTypeScript

java.lang.Object
org.apache.fontbox.ttf.OpenTypeScript

public final class OpenTypeScript extends Object
A class for mapping Unicode codepoints to OpenType script tags
See Also:
  • Field Details

    • LOG

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

      public static final String INHERITED
      See Also:
    • UNKNOWN

      public static final String UNKNOWN
      See Also:
    • TAG_DEFAULT

      public static final String TAG_DEFAULT
      See Also:
    • UNICODE_SCRIPT_TO_OPENTYPE_TAG_MAP

      private static final Map<String,String[]> UNICODE_SCRIPT_TO_OPENTYPE_TAG_MAP
      A map associating Unicode scripts with one or more OpenType script tags. Script tags are not necessarily the same as Unicode scripts. A single Unicode script may correspond to multiple tags, especially when there has been a revision to the latter (e.g. Bengali -> [bng2, beng]). When there are multiple tags, they are ordered from newest to oldest.
      See Also:
    • unicodeRangeStarts

      private static int[] unicodeRangeStarts
    • unicodeRangeScripts

      private static String[] unicodeRangeScripts
  • Constructor Details

    • OpenTypeScript

      private OpenTypeScript()
  • Method Details

    • parseScriptsFile

      private static void parseScriptsFile(InputStream inputStream) throws IOException
      Throws:
      IOException
    • getUnicodeScript

      private static String getUnicodeScript(int codePoint)
      Obtain the Unicode script associated with the given Unicode codepoint.
      Parameters:
      codePoint -
      Returns:
      A Unicode script string, or #UNKNOWN if unknown
    • getScriptTags

      public static String[] getScriptTags(int codePoint)
      Obtain the OpenType script tags associated with the given Unicode codepoint. The result may contain the special value #INHERITED, which indicates that the codepoint's script can only be determined by its context. Unknown codepoints are mapped to #TAG_DEFAULT.
      Parameters:
      codePoint -
      Returns:
      An array of four-char script tags
    • ensureValidCodePoint

      private static void ensureValidCodePoint(int codePoint)