Package com.itextpdf.text.pdf.fonts.otf
Class GlyphSubstitutionTableReader
java.lang.Object
com.itextpdf.text.pdf.fonts.otf.OpenTypeFontTableReader
com.itextpdf.text.pdf.fonts.otf.GlyphSubstitutionTableReader
Parses an OpenTypeFont file and reads the Glyph Substitution Table. This table governs how two or more Glyphs should be merged to a single Glyph. This is especially useful for Asian languages like Bangla, Hindi, etc.
This has been written according to the OPenTypeFont specifications. This may be found here.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final int[]
Fields inherited from class com.itextpdf.text.pdf.fonts.otf.OpenTypeFontTableReader
LOG, rf, tableLocation
-
Constructor Summary
ConstructorsConstructorDescriptionGlyphSubstitutionTableReader
(RandomAccessFileOrArray rf, int gsubTableLocation, Map<Integer, Character> glyphToCharacterMap, int[] glyphWidthsByIndex) -
Method Summary
Modifier and TypeMethodDescriptionprivate String
getTextFromGlyph
(int glyphId, Map<Integer, Character> glyphToCharacterMap) void
read()
private void
readLigatureSetTable
(int ligatureSetTableLocation, int coverageGlyphId) private void
readLigatureSubstitutionSubtable
(int ligatureSubstitutionSubtableLocation) LookupType 4: Ligature Substitution Subtableprivate void
readLigatureTable
(int ligatureTableLocation, int coverageGlyphId) private void
readSingleSubstitutionSubtable
(int subTableLocation) LookupType 1: Single Substitution Subtableprotected void
readSubTable
(int lookupType, int subTableLocation) Methods inherited from class com.itextpdf.text.pdf.fonts.otf.OpenTypeFontTableReader
getSupportedLanguage, readCoverageFormat, startReadingTable
-
Field Details
-
glyphWidthsByIndex
private final int[] glyphWidthsByIndex -
glyphToCharacterMap
-
rawLigatureSubstitutionMap
-
-
Constructor Details
-
GlyphSubstitutionTableReader
public GlyphSubstitutionTableReader(RandomAccessFileOrArray rf, int gsubTableLocation, Map<Integer, Character> glyphToCharacterMap, int[] glyphWidthsByIndex) throws IOException- Throws:
IOException
-
-
Method Details
-
read
- Throws:
FontReadingException
-
getGlyphSubstitutionMap
- Throws:
FontReadingException
-
getTextFromGlyph
private String getTextFromGlyph(int glyphId, Map<Integer, Character> glyphToCharacterMap) throws FontReadingException- Throws:
FontReadingException
-
readSubTable
- Specified by:
readSubTable
in classOpenTypeFontTableReader
- Throws:
IOException
-
readSingleSubstitutionSubtable
LookupType 1: Single Substitution Subtable- Throws:
IOException
-
readLigatureSubstitutionSubtable
private void readLigatureSubstitutionSubtable(int ligatureSubstitutionSubtableLocation) throws IOException LookupType 4: Ligature Substitution Subtable- Throws:
IOException
-
readLigatureSetTable
private void readLigatureSetTable(int ligatureSetTableLocation, int coverageGlyphId) throws IOException - Throws:
IOException
-
readLigatureTable
- Throws:
IOException
-