package com.lowagie.text.pdf.languages;
import java.util.List;
import com.lowagie.text.pdf.Glyph;
/**
*
* @author Palash Ray
*/
abstract class IndicGlyphRepositioner implements GlyphRepositioner {
public void repositionGlyphs(List glyphList) {
for (int i = 0; i < glyphList.size(); i++) {
Glyph glyph = glyphList.get(i);
Glyph nextGlyph = getNextGlyph(glyphList, i);
if ((nextGlyph != null)
&& getCharactersToBeShiftedLeftByOnePosition().contains(
nextGlyph.chars)) {
glyphList.set(i, nextGlyph);
glyphList.set(i + 1, glyph);
i++;
continue;
}
}
}
abstract List getCharactersToBeShiftedLeftByOnePosition();
private Glyph getNextGlyph(List glyphs, int currentIndex) {
if (currentIndex + 1 < glyphs.size()) {
return glyphs.get(currentIndex + 1);
} else {
return null;
}
}
}