Ejemplo n.º 1
0
        private List <int> ApplyGsubFeature(ScriptFeature scriptFeature, List <int> originalGlyphs)
        {
            GlyphArraySplitter glyphArraySplitter = new GlyphArraySplitterRegexImpl(scriptFeature.AllGlyphIdsForSubstitution);

            List <List <int> > tokens = glyphArraySplitter.Split(originalGlyphs);

            List <int> gsubProcessedGlyphs = new List <int>();

            foreach (List <int> chunk in tokens)
            {
                if (scriptFeature.CanReplaceGlyphs(chunk))
                {
                    // gsub system kicks in, you get the glyphId directly
                    int glyphId = scriptFeature.GetReplacementForGlyphs(chunk);
                    gsubProcessedGlyphs.Add(glyphId);
                }
                else
                {
                    gsubProcessedGlyphs.AddAll(chunk);
                }
            }

            Debug.WriteLine($"debug: originalGlyphs: {originalGlyphs}, gsubProcessedGlyphs: {gsubProcessedGlyphs}");

            return(gsubProcessedGlyphs);
        }
Ejemplo n.º 2
0
        private List <int> GetBeforeHalfGlyphIds()
        {
            List <int> glyphIds = new List <int>();

            foreach (char character in BEFORE_HALF_CHARS)
            {
                glyphIds.Add(GetGlyphId(character));
            }

            if (gsubData.IsFeatureSupported(INIT_FEATURE))
            {
                ScriptFeature feature = gsubData.GetFeature(INIT_FEATURE);
                foreach (List <int> glyphCluster in feature.AllGlyphIdsForSubstitution)
                {
                    glyphIds.Add(feature.GetReplacementForGlyphs(glyphCluster));
                }
            }

            return(glyphIds);
        }