//private static readonly Log LOG = LogFactory.getLog(GlyphSubstitutionDataExtractor.class);

        public GsubData GetGsubData(Dictionary <string, ScriptTable> scriptList, FeatureListTable featureListTable, LookupListTable lookupListTable)
        {
            ScriptTableDetails scriptTableDetails = GetSupportedLanguage(scriptList);

            if (scriptTableDetails == null)
            {
                return(DefaultGsubData.NO_DATA_FOUND);
            }

            ScriptTable scriptTable = scriptTableDetails.ScriptTable;

            Dictionary <string, Dictionary <List <int>, int> > gsubData = new Dictionary <string, Dictionary <List <int>, int> >(StringComparer.Ordinal);

            // the starting point is really the scriptTags
            if (scriptTable.DefaultLangSysTable != null)
            {
                PopulateGsubData(gsubData, scriptTable.DefaultLangSysTable, featureListTable,
                                 lookupListTable);
            }
            foreach (LangSysTable langSysTable in scriptTable.LangSysTables.Values)
            {
                PopulateGsubData(gsubData, langSysTable, featureListTable, lookupListTable);
            }

            return(new MapBackedGsubData(scriptTableDetails.Language, scriptTableDetails.FeatureName, gsubData));
        }
 private void PopulateGsubData(Dictionary <string, Dictionary <List <int>, int> > gsubData,
                               LangSysTable langSysTable, FeatureListTable featureListTable,
                               LookupListTable lookupListTable)
 {
     FeatureRecord[] featureRecords = featureListTable.FeatureRecords;
     foreach (int featureIndex in langSysTable.FeatureIndices)
     {
         if (featureIndex < featureRecords.Length)
         {
             PopulateGsubData(gsubData, featureRecords[featureIndex], lookupListTable);
         }
     }
 }