fontbox/src/main/java/org/apache/fontbox/ttf/gsub/GsubWorkerForGujarati.java [105:146]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    private List<Integer> applyRKRFFeature(ScriptFeature rkrfGlyphsForSubstitution,
            List<Integer> originalGlyphIds)
    {
        Set<List<Integer>> rkrfGlyphIds = rkrfGlyphsForSubstitution.getAllGlyphIdsForSubstitution();
        if (rkrfGlyphIds.isEmpty())
        {
            LOG.debug("Glyph substitution list for {} is empty.", rkrfGlyphsForSubstitution.getName());
            return originalGlyphIds;
        }

        // Replace this with better implementation to get second GlyphId from rkrfGlyphIds
        int rkrfReplacement = 0;
        for (List<Integer> firstList : rkrfGlyphIds)
        {
            if (firstList.size() > 1)
            {
                rkrfReplacement = firstList.get(1);
                break;
            }
        }
        if (rkrfReplacement == 0)
        {
            LOG.debug("Cannot find rkrf candidate. The rkrfGlyphIds doesn't contain lists of two elements.");
            return originalGlyphIds;
        }

        List<Integer> rkrfList = new ArrayList<>(originalGlyphIds);
        for (int index = originalGlyphIds.size() - 1; index > 1; index--)
        {
            int raGlyph = originalGlyphIds.get(index);
            if (raGlyph == rephGlyphIds.get(0))
            {
                int viramaGlyph = originalGlyphIds.get(index - 1);
                if (viramaGlyph == rephGlyphIds.get(1))
                {
                    rkrfList.set(index - 1, rkrfReplacement);
                    rkrfList.remove(index);
                }
            }
        }
        return rkrfList;
    }
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



fontbox/src/main/java/org/apache/fontbox/ttf/gsub/GsubWorkerForDevanagari.java [106:147]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    private List<Integer> applyRKRFFeature(ScriptFeature rkrfGlyphsForSubstitution,
            List<Integer> originalGlyphIds)
    {
        Set<List<Integer>> rkrfGlyphIds = rkrfGlyphsForSubstitution.getAllGlyphIdsForSubstitution();
        if (rkrfGlyphIds.isEmpty())
        {
            LOG.debug("Glyph substitution list for {} is empty.", rkrfGlyphsForSubstitution.getName());
            return originalGlyphIds;
        }
        // Replace this with better implementation to get second GlyphId from rkrfGlyphIds
        int rkrfReplacement = 0;
        for (List<Integer> firstList : rkrfGlyphIds)
        {
            if (firstList.size() > 1)
            {
                rkrfReplacement = firstList.get(1);
                break;
            }
        }

        if (rkrfReplacement == 0)
        {
            LOG.debug("Cannot find rkrf candidate. The rkrfGlyphIds doesn't contain lists of two elements.");
            return originalGlyphIds;
        }

        List<Integer> rkrfList = new ArrayList<>(originalGlyphIds);
        for (int index = originalGlyphIds.size() - 1; index > 1; index--)
        {
            int raGlyph = originalGlyphIds.get(index);
            if (raGlyph == rephGlyphIds.get(0))
            {
                int viramaGlyph = originalGlyphIds.get(index - 1);
                if (viramaGlyph == rephGlyphIds.get(1))
                {
                    rkrfList.set(index - 1, rkrfReplacement);
                    rkrfList.remove(index);
                }
            }
        }
        return rkrfList;
    }
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



