TrueTypeReader
Overview
TrueTypeReader is a class in Aspose.PDF FOSS for Java.
Reads TrueType/OpenType font files (sfnt format).
This class provides 12 methods for working with TrueTypeReader objects in Java programs.
Available methods include: TrueTypeReader, getAdvanceWidth, getCmapEntries, getFontName, getGlyphId, getGlyphName, getGlyphPath, getNumGlyphs, getUnicodeForGlyphId, getUnicodeForGlyphIdPreferUnicode, getUnitsPerEm, hasUnicodeCmap.
All public members are accessible to any Java application after installing the Aspose.PDF FOSS for Java package.
Properties: cmapEntries, fontName, numGlyphs, unitsPerEm.
Properties
| Name | Type | Access | Description |
|---|---|---|---|
unitsPerEm | int | Read | Returns the font’s unitsPerEm value from the head table. |
numGlyphs | int | Read | Returns the number of glyphs in the font. |
fontName | String | Read | Returns the font name from the name table (if available). |
cmapEntries | java.util.Map<Integer, Integer> | Read | Returns an unmodifiable view of the Unicode-to-glyph cmap as a map. |
Methods
| Signature | Description |
|---|---|
TrueTypeReader(data: byte[]) | Creates a TrueTypeReader from raw font data. |
getUnitsPerEm() → int | Returns the font’s unitsPerEm value from the head table. |
getNumGlyphs() → int | Returns the number of glyphs in the font. |
getGlyphId(charCode: int) → int | Maps a character code to a glyph ID using the cmap table. |
getUnicodeForGlyphId(glyphId: int) → int | Returns the first Unicode code point mapped to the given glyph ID. |
getUnicodeForGlyphIdPreferUnicode(glyphId: int) → int | Returns the Unicode code point for the given glyph ID using ONLY the |
| true-Unicode cmap subtables (see {@link #unicodeReverseCmap}). | |
hasUnicodeCmap() → boolean | Returns true if the font ships at least one true-Unicode cmap subtable |
| (platform 3 encoding 1/10, or platform 0). | |
getGlyphName(glyphId: int) → String | Returns the PostScript name for the glyph from the {@code /post} table, |
| or {@code null} if the post table was missing, used a format we don’t | |
| parse, or the glyph id is out of range. | |
getAdvanceWidth(glyphId: int) → int | Returns the advance width for the given glyph ID, in font units. |
getFontName() → String | Returns the font name from the name table (if available). |
getCmapEntries() → java.util.Map<Integer, Integer> | Returns an unmodifiable view of the Unicode-to-glyph cmap as a map. |
getGlyphPath(gid: int) → java.awt.geom.GeneralPath | Returns the outline of a glyph as a {@link java.awt.geom.GeneralPath} in |
| em-normalised coordinates (font units divided by {@code unitsPerEm}), with | |
| the TrueType Y-up orientation preserved. |