fontbox/src/main/java/org/apache/fontbox/ttf/gsub/GsubWorkerForGujarati.java [177:204]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    private List<Integer> adjustRephPosition(List<Integer> originalGlyphIds)
    {
        List<Integer> rephAdjustedList = new ArrayList<>(originalGlyphIds);
        for (int index = 0; index < originalGlyphIds.size() - 2; index++)
        {
            int raGlyph = originalGlyphIds.get(index);
            int viramaGlyph = originalGlyphIds.get(index + 1);
            if (raGlyph == rephGlyphIds.get(0) && viramaGlyph == rephGlyphIds.get(1))
            {
                int nextConsonantGlyph = originalGlyphIds.get(index + 2);
                rephAdjustedList.set(index, nextConsonantGlyph);
                rephAdjustedList.set(index + 1, raGlyph);
                rephAdjustedList.set(index + 2, viramaGlyph);

                if (index + 3 < originalGlyphIds.size())
                {
                    int matraGlyph = originalGlyphIds.get(index + 3);
                    if (beforeRephGlyphIds.contains(matraGlyph))
                    {
                        rephAdjustedList.set(index + 1, matraGlyph);
                        rephAdjustedList.set(index + 2, raGlyph);
                        rephAdjustedList.set(index + 3, viramaGlyph);
                    }
                }
            }
        }
        return rephAdjustedList;
    }
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



fontbox/src/main/java/org/apache/fontbox/ttf/gsub/GsubWorkerForDevanagari.java [149:176]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    private List<Integer> adjustRephPosition(List<Integer> originalGlyphIds)
    {
        List<Integer> rephAdjustedList = new ArrayList<>(originalGlyphIds);
        for (int index = 0; index < originalGlyphIds.size() - 2; index++)
        {
            int raGlyph = originalGlyphIds.get(index);
            int viramaGlyph = originalGlyphIds.get(index + 1);
            if (raGlyph == rephGlyphIds.get(0) && viramaGlyph == rephGlyphIds.get(1))
            {
                int nextConsonantGlyph = originalGlyphIds.get(index + 2);
                rephAdjustedList.set(index, nextConsonantGlyph);
                rephAdjustedList.set(index + 1, raGlyph);
                rephAdjustedList.set(index + 2, viramaGlyph);

                if (index + 3 < originalGlyphIds.size())
                {
                    int matraGlyph = originalGlyphIds.get(index + 3);
                    if (beforeRephGlyphIds.contains(matraGlyph))
                    {
                        rephAdjustedList.set(index + 1, matraGlyph);
                        rephAdjustedList.set(index + 2, raGlyph);
                        rephAdjustedList.set(index + 3, viramaGlyph);
                    }
                }
            }
        }
        return rephAdjustedList;
    }
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



