Package org.apache.fontbox.ttf.gsub
Class GlyphSubstitutionDataExtractor
- java.lang.Object
-
- org.apache.fontbox.ttf.gsub.GlyphSubstitutionDataExtractor
-
public class GlyphSubstitutionDataExtractor extends java.lang.ObjectThis class has utility methods to extract meaningful GsubData from the highly obfuscated GSUB Tables. This GsubData is then used to determine which combination of glyphs or words have to be replaced.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classGlyphSubstitutionDataExtractor.ScriptTableDetails
-
Field Summary
Fields Modifier and Type Field Description private static org.apache.commons.logging.LogLOG
-
Constructor Summary
Constructors Constructor Description GlyphSubstitutionDataExtractor()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private MapBackedGsubDatabuildMapBackedGsubData(FeatureListTable featureListTable, LookupListTable lookupListTable, GlyphSubstitutionDataExtractor.ScriptTableDetails scriptTableDetails)private voidextractData(java.util.Map<java.util.List<java.lang.Integer>,java.lang.Integer> glyphSubstitutionMap, LookupTable lookupTable)private voidextractDataFromAlternateSubstitutionSubstFormat1Table(java.util.Map<java.util.List<java.lang.Integer>,java.lang.Integer> glyphSubstitutionMap, LookupTypeAlternateSubstitutionFormat1 alternateSubstitutionFormat1)Extracts data from the AlternateSubstitutionFormat1 (lookuptype) 3 table and puts it in the glyphSubstitutionMap.private voidextractDataFromLigatureSubstitutionSubstFormat1Table(java.util.Map<java.util.List<java.lang.Integer>,java.lang.Integer> glyphSubstitutionMap, LookupTypeLigatureSubstitutionSubstFormat1 ligatureSubstitutionTable)private voidextractDataFromLigatureTable(java.util.Map<java.util.List<java.lang.Integer>,java.lang.Integer> glyphSubstitutionMap, LigatureTable ligatureTable)private voidextractDataFromMultipleSubstitutionFormat1Table(java.util.Map<java.util.List<java.lang.Integer>,java.lang.Integer> glyphSubstitutionMap, LookupTypeMultipleSubstitutionFormat1 multipleSubstFormat1Subtable)private voidextractDataFromSingleSubstTableFormat1Table(java.util.Map<java.util.List<java.lang.Integer>,java.lang.Integer> glyphSubstitutionMap, LookupTypeSingleSubstFormat1 singleSubstTableFormat1)private voidextractDataFromSingleSubstTableFormat2Table(java.util.Map<java.util.List<java.lang.Integer>,java.lang.Integer> glyphSubstitutionMap, LookupTypeSingleSubstFormat2 singleSubstTableFormat2)GsubDatagetGsubData(java.lang.String scriptName, ScriptTable scriptTable, FeatureListTable featureListTable, LookupListTable lookupListTable)UnlikegetGsubData(Map, FeatureListTable, LookupListTable), this method doesn't iterate over supportedLanguage's searching for the first match with the scripts of the font.GsubDatagetGsubData(java.util.Map<java.lang.String,ScriptTable> scriptList, FeatureListTable featureListTable, LookupListTable lookupListTable)private GlyphSubstitutionDataExtractor.ScriptTableDetailsgetSupportedLanguage(java.util.Map<java.lang.String,ScriptTable> scriptList)private voidpopulateGsubData(java.util.Map<java.lang.String,java.util.Map<java.util.List<java.lang.Integer>,java.lang.Integer>> gsubData, FeatureRecord featureRecord, LookupListTable lookupListTable)private voidpopulateGsubData(java.util.Map<java.lang.String,java.util.Map<java.util.List<java.lang.Integer>,java.lang.Integer>> gsubData, LangSysTable langSysTable, FeatureListTable featureListTable, LookupListTable lookupListTable)private voidputNewSubstitutionEntry(java.util.Map<java.util.List<java.lang.Integer>,java.lang.Integer> glyphSubstitutionMap, int newGlyph, java.util.List<java.lang.Integer> glyphsToBeSubstituted)
-
-
-
Method Detail
-
getGsubData
public GsubData getGsubData(java.util.Map<java.lang.String,ScriptTable> scriptList, FeatureListTable featureListTable, LookupListTable lookupListTable)
-
getGsubData
public GsubData getGsubData(java.lang.String scriptName, ScriptTable scriptTable, FeatureListTable featureListTable, LookupListTable lookupListTable)
UnlikegetGsubData(Map, FeatureListTable, LookupListTable), this method doesn't iterate over supportedLanguage's searching for the first match with the scripts of the font. Instead, it unconditionally createsGlyphSubstitutionDataExtractor.ScriptTableDetailsinstance with language left unspecified.- Parameters:
scriptName-scriptTable-featureListTable-lookupListTable-- Returns:
GsubDatainstance built especially for the givenscriptName
-
buildMapBackedGsubData
private MapBackedGsubData buildMapBackedGsubData(FeatureListTable featureListTable, LookupListTable lookupListTable, GlyphSubstitutionDataExtractor.ScriptTableDetails scriptTableDetails)
-
getSupportedLanguage
private GlyphSubstitutionDataExtractor.ScriptTableDetails getSupportedLanguage(java.util.Map<java.lang.String,ScriptTable> scriptList)
-
populateGsubData
private void populateGsubData(java.util.Map<java.lang.String,java.util.Map<java.util.List<java.lang.Integer>,java.lang.Integer>> gsubData, LangSysTable langSysTable, FeatureListTable featureListTable, LookupListTable lookupListTable)
-
populateGsubData
private void populateGsubData(java.util.Map<java.lang.String,java.util.Map<java.util.List<java.lang.Integer>,java.lang.Integer>> gsubData, FeatureRecord featureRecord, LookupListTable lookupListTable)
-
extractData
private void extractData(java.util.Map<java.util.List<java.lang.Integer>,java.lang.Integer> glyphSubstitutionMap, LookupTable lookupTable)
-
extractDataFromSingleSubstTableFormat1Table
private void extractDataFromSingleSubstTableFormat1Table(java.util.Map<java.util.List<java.lang.Integer>,java.lang.Integer> glyphSubstitutionMap, LookupTypeSingleSubstFormat1 singleSubstTableFormat1)
-
extractDataFromSingleSubstTableFormat2Table
private void extractDataFromSingleSubstTableFormat2Table(java.util.Map<java.util.List<java.lang.Integer>,java.lang.Integer> glyphSubstitutionMap, LookupTypeSingleSubstFormat2 singleSubstTableFormat2)
-
extractDataFromMultipleSubstitutionFormat1Table
private void extractDataFromMultipleSubstitutionFormat1Table(java.util.Map<java.util.List<java.lang.Integer>,java.lang.Integer> glyphSubstitutionMap, LookupTypeMultipleSubstitutionFormat1 multipleSubstFormat1Subtable)
-
extractDataFromLigatureSubstitutionSubstFormat1Table
private void extractDataFromLigatureSubstitutionSubstFormat1Table(java.util.Map<java.util.List<java.lang.Integer>,java.lang.Integer> glyphSubstitutionMap, LookupTypeLigatureSubstitutionSubstFormat1 ligatureSubstitutionTable)
-
extractDataFromAlternateSubstitutionSubstFormat1Table
private void extractDataFromAlternateSubstitutionSubstFormat1Table(java.util.Map<java.util.List<java.lang.Integer>,java.lang.Integer> glyphSubstitutionMap, LookupTypeAlternateSubstitutionFormat1 alternateSubstitutionFormat1)Extracts data from the AlternateSubstitutionFormat1 (lookuptype) 3 table and puts it in the glyphSubstitutionMap.- Parameters:
glyphSubstitutionMap- the map to store the substitution dataalternateSubstitutionFormat1- the alternate substitution format 1 table
-
extractDataFromLigatureTable
private void extractDataFromLigatureTable(java.util.Map<java.util.List<java.lang.Integer>,java.lang.Integer> glyphSubstitutionMap, LigatureTable ligatureTable)
-
putNewSubstitutionEntry
private void putNewSubstitutionEntry(java.util.Map<java.util.List<java.lang.Integer>,java.lang.Integer> glyphSubstitutionMap, int newGlyph, java.util.List<java.lang.Integer> glyphsToBeSubstituted)
-
-