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
-
public class GlyphSubstitutionTableReader extends OpenTypeFontTableReader
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
Fields Modifier and Type Field Description private java.util.Map<java.lang.Integer,java.lang.Character>glyphToCharacterMapprivate int[]glyphWidthsByIndexprivate java.util.Map<java.lang.Integer,java.util.List<java.lang.Integer>>rawLigatureSubstitutionMap-
Fields inherited from class com.itextpdf.text.pdf.fonts.otf.OpenTypeFontTableReader
LOG, rf, tableLocation
-
-
Constructor Summary
Constructors Constructor Description GlyphSubstitutionTableReader(RandomAccessFileOrArray rf, int gsubTableLocation, java.util.Map<java.lang.Integer,java.lang.Character> glyphToCharacterMap, int[] glyphWidthsByIndex)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Map<java.lang.String,Glyph>getGlyphSubstitutionMap()private java.lang.StringgetTextFromGlyph(int glyphId, java.util.Map<java.lang.Integer,java.lang.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 com.itextpdf.text.pdf.fonts.otf.OpenTypeFontTableReader
getSupportedLanguage, readCoverageFormat, startReadingTable
-
-
-
-
Field Detail
-
glyphWidthsByIndex
private final int[] glyphWidthsByIndex
-
glyphToCharacterMap
private final java.util.Map<java.lang.Integer,java.lang.Character> glyphToCharacterMap
-
rawLigatureSubstitutionMap
private java.util.Map<java.lang.Integer,java.util.List<java.lang.Integer>> rawLigatureSubstitutionMap
-
-
Constructor Detail
-
GlyphSubstitutionTableReader
public GlyphSubstitutionTableReader(RandomAccessFileOrArray rf, int gsubTableLocation, java.util.Map<java.lang.Integer,java.lang.Character> glyphToCharacterMap, int[] glyphWidthsByIndex) throws java.io.IOException
- Throws:
java.io.IOException
-
-
Method Detail
-
read
public void read() throws FontReadingException- Throws:
FontReadingException
-
getGlyphSubstitutionMap
public java.util.Map<java.lang.String,Glyph> getGlyphSubstitutionMap() throws FontReadingException
- Throws:
FontReadingException
-
getTextFromGlyph
private java.lang.String getTextFromGlyph(int glyphId, java.util.Map<java.lang.Integer,java.lang.Character> glyphToCharacterMap) throws FontReadingException- Throws:
FontReadingException
-
readSubTable
protected void readSubTable(int lookupType, int subTableLocation) throws java.io.IOException- Specified by:
readSubTablein classOpenTypeFontTableReader- Throws:
java.io.IOException
-
readSingleSubstitutionSubtable
private void readSingleSubstitutionSubtable(int subTableLocation) throws java.io.IOExceptionLookupType 1: Single Substitution Subtable- Throws:
java.io.IOException
-
readLigatureSubstitutionSubtable
private void readLigatureSubstitutionSubtable(int ligatureSubstitutionSubtableLocation) throws java.io.IOExceptionLookupType 4: Ligature Substitution Subtable- Throws:
java.io.IOException
-
readLigatureSetTable
private void readLigatureSetTable(int ligatureSetTableLocation, int coverageGlyphId) throws java.io.IOException- Throws:
java.io.IOException
-
readLigatureTable
private void readLigatureTable(int ligatureTableLocation, int coverageGlyphId) throws java.io.IOException- Throws:
java.io.IOException
-
-