java.lang.Object
gnu.java.awt.font.opentype.CharGlyphMap
gnu.java.awt.font.opentype.CharGlyphMap.Type4
- Enclosing class:
- CharGlyphMap
- private static final class CharGlyphMap.Type4
- extends CharGlyphMap
A mapping from Unicode code points to glyph IDs through CMAP Type
4 tables. These tables are able to map two-byte encoded text
to glyph IDs, such as Unicode Basic Multilingual Plane which
contains U+0000 .. U+FFFE without surrogates.
|
Method Summary |
private int |
find(char c)
|
static CharGlyphMap |
forTable(java.nio.ByteBuffer buf)
Reads a CharGlyphMap from an OpenType or TrueType cmap
table. |
int |
getGlyph(int ucs4)
Determines the glyph index for a given Unicode codepoint. |
(package private) static boolean |
isSupported(int platform,
int language,
int encoding)
Determines whether this implementation supports a combination
of platform, language and encoding is supported for a type 4
cmap table. |
(package private) static CharGlyphMap.Type4 |
readTable(java.nio.ByteBuffer buf,
int platform,
int encoding)
Processes a CMAP Type 4 table whose platform, encoding and
language are already known. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
lastChar
private java.nio.CharBuffer lastChar
firstChar
private java.nio.CharBuffer firstChar
idDelta
private java.nio.ShortBuffer idDelta
rangeID
private java.nio.CharBuffer rangeID
numSegments
private int numSegments
CharGlyphMap.Type4
private CharGlyphMap.Type4(int numSegments,
java.nio.CharBuffer lastChar,
java.nio.CharBuffer firstChar,
java.nio.ShortBuffer idDelta,
java.nio.CharBuffer rangeID)
isSupported
static boolean isSupported(int platform,
int language,
int encoding)
- Determines whether this implementation supports a combination
of platform, language and encoding is supported for a type 4
cmap table.
Currently, we support the following combinations:
- the Unicode platform in encodings 0, 1, 2, 3 and
4;
- the Microsoft platform in encodings 1 (Basic Multilingual
Plane) and 10 (full Unicode).
Most recent Macintosh fonts provide a type 4
cmap for Unicode. Microsoft recommends providing a
type 4 cmap for encoding 1 of the Microsoft
platform. The implementation of GNU Classpath supports both
variants.
Not supported are ShiftJIS, Big5, Wansung, Johab, and other
non-Unicode encodings. Text can easily be converted to Unicode
using the java.nio.charset package.
readTable
static CharGlyphMap.Type4 readTable(java.nio.ByteBuffer buf,
int platform,
int encoding)
- Processes a CMAP Type 4 table whose platform, encoding and
language are already known. We understand the Unicode platform
with encodings 0, 1, 2, 3 and 4, and the Microsoft platform
with encodings 1 (Unicode BMP) and 10 (UCS-4).
getGlyph
public int getGlyph(int ucs4)
- Determines the glyph index for a given Unicode codepoint.
- Specified by:
getGlyph in class CharGlyphMap
find
private int find(char c)
forTable
public static CharGlyphMap forTable(java.nio.ByteBuffer buf)
- Reads a CharGlyphMap from an OpenType or TrueType
cmap
table. The current implementation works as follows:
- If the font has a type 4 cmap for the Unicode platform
(encoding 0, 1, 2, 3 or 4), or a type 4 cmap for the Microsoft
platform (encodings 1 or 10), that table is used to map Unicode
codepoints to glyphs. Most recent fonts, both for Macintosh and
Windows, should provide such a table.
- Otherwise, if the font has any type 0 cmap for the Macintosh
platform, a Unicode-to-glyph mapping is synthesized from certain
type 0 cmaps. The current implementation collects mappings from
Roman, Icelandic, Turkish, Croatian, Romanian, Eastern European,
Cyrillic, Greek, Hebrew, Arabic and Farsi cmaps.
.