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 OpenTypeFontTableReader
LOG, rf, tableLocation -
Constructor Summary
ConstructorsConstructorDescriptionGlyphSubstitutionTableReader(RandomAccessFileOrArray rf, int gsubTableLocation, Map<Integer, Character> glyphToCharacterMap, int[] glyphWidthsByIndex) -
Method Summary
Modifier and TypeMethodDescriptionprivate StringgetTextFromGlyph(int glyphId, Map<Integer, Character> glyphToCharacterMap) voidread()private voidreadLigatureSetTable(int ligatureSetTableLocation, int coverageGlyphId) private voidreadLigatureSubstitutionSubtable(int ligatureSubstitutionSubtableLocation) LookupType 4: Ligature Substitution Subtableprivate voidreadLigatureTable(int ligatureTableLocation, int coverageGlyphId) private voidreadSingleSubstitutionSubtable(int subTableLocation) LookupType 1: Single Substitution Subtableprotected voidreadSubTable(int lookupType, int subTableLocation) Methods inherited from class 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:
readSubTablein 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
-