Package org.apache.fontbox.ttf
Class OpenTypeScript
- java.lang.Object
-
- org.apache.fontbox.ttf.OpenTypeScript
-
public final class OpenTypeScript extends java.lang.Object
A class for mapping Unicode codepoints to OpenType script tags
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
INHERITED
private static org.apache.commons.logging.Log
LOG
static java.lang.String
TAG_DEFAULT
private static java.util.Map<java.lang.String,java.lang.String[]>
UNICODE_SCRIPT_TO_OPENTYPE_TAG_MAP
A map associating Unicode scripts with one or more OpenType script tags.private static java.lang.String[]
unicodeRangeScripts
private static int[]
unicodeRangeStarts
static java.lang.String
UNKNOWN
-
Constructor Summary
Constructors Modifier Constructor Description private
OpenTypeScript()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description private static void
ensureValidCodePoint(int codePoint)
static java.lang.String[]
getScriptTags(int codePoint)
Obtain the OpenType script tags associated with the given Unicode codepoint.private static java.lang.String
getUnicodeScript(int codePoint)
Obtain the Unicode script associated with the given Unicode codepoint.private static void
parseScriptsFile(java.io.InputStream inputStream)
-
-
-
Field Detail
-
LOG
private static final org.apache.commons.logging.Log LOG
-
INHERITED
public static final java.lang.String INHERITED
- See Also:
- Constant Field Values
-
UNKNOWN
public static final java.lang.String UNKNOWN
- See Also:
- Constant Field Values
-
TAG_DEFAULT
public static final java.lang.String TAG_DEFAULT
- See Also:
- Constant Field Values
-
UNICODE_SCRIPT_TO_OPENTYPE_TAG_MAP
private static final java.util.Map<java.lang.String,java.lang.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:
- Microsoft Typography: Script Tags
-
unicodeRangeStarts
private static int[] unicodeRangeStarts
-
unicodeRangeScripts
private static java.lang.String[] unicodeRangeScripts
-
-
Method Detail
-
parseScriptsFile
private static void parseScriptsFile(java.io.InputStream inputStream) throws java.io.IOException
- Throws:
java.io.IOException
-
getUnicodeScript
private static java.lang.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 java.lang.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)
-
-