for (int i = 0; i < ng; i++) {
int gid = ga [ i ];
int gw = unscaledWidths [ i ];
- if (isReorderedMark(gdef, ga, unscaledWidths, i)) {
+ int[] pa = (gpa != null) ? gpa[i] : null;
+ if (isReorderedMark(gdef, ga, unscaledWidths, i, pa)) {
nm++;
}
}
int gid = ga [ i ];
int[] pa = (gpa != null) ? gpa [ i ] : null;
CharAssociation ca = aa [ i ];
- if (isReorderedMark(gdef, ga, unscaledWidths, i)) {
+ if (isReorderedMark(gdef, ga, unscaledWidths, i, pa)) {
nga [ k ] = gid;
naa [ k ] = ca;
if (npa != null) {
}
}
- protected boolean isReorderedMark(GlyphDefinitionTable gdef, int[] glyphs, int[] unscaledWidths, int index) {
- return gdef.isGlyphClass(glyphs[index], GlyphDefinitionTable.GLYPH_CLASS_MARK);
+ protected boolean isReorderedMark(GlyphDefinitionTable gdef, int[] glyphs, int[] unscaledWidths, int index, int[] pa) {
+ pa = (pa != null) ? pa : new int[1];
+ return gdef.isGlyphClass(glyphs[index], GlyphDefinitionTable.GLYPH_CLASS_MARK) && pa[0] != 0;
}
}
super(script);
}
- protected boolean isReorderedMark(GlyphDefinitionTable gdef, int[] glyphs, int[] unscaledWidths, int index) {
+ @Override
+ protected boolean isReorderedMark(
+ GlyphDefinitionTable gdef, int[] glyphs, int[] unscaledWidths, int index, int[] pa) {
return gdef.isGlyphClass(glyphs[index], GlyphDefinitionTable.GLYPH_CLASS_MARK) && (unscaledWidths[index] != 0);
}
}
super(script);
}
- protected boolean isReorderedMark(GlyphDefinitionTable gdef, int[] glyphs, int[] unscaledWidths, int index) {
+ @Override
+ protected boolean isReorderedMark(
+ GlyphDefinitionTable gdef, int[] glyphs, int[] unscaledWidths, int index, int[] pa) {
return gdef.isGlyphClass(glyphs[index], GlyphDefinitionTable.GLYPH_CLASS_MARK);
}
}
public class DefaultScriptTestCase {
@Test
- public void testProcessor() {
+ public void testProcessorReorder() {
String in = "\u00F6\u0323";
+ int[][] gpa = new int[2][1];
+ gpa[0][0] = 1;
+ gpa[1][0] = 1;
+ String actual = getFont().reorderCombiningMarks(in, gpa, OTFScript.DEFAULT, null, null).toString();
+ Assert.assertEquals(actual.charAt(0), 803);
+ }
+
+ @Test
+ public void testProcessorNoReorder() {
+ String in = "\u00F6\u0323";
+ int[][] gpa = new int[2][1];
+ String actual = getFont().reorderCombiningMarks(in, gpa, OTFScript.DEFAULT, null, null).toString();
+ Assert.assertEquals(actual.charAt(0), 57344);
+ }
+
+ private MultiByteFont getFont() {
MultiByteFont font = new MultiByteFont(null, null);
font.setWidthArray(new int[0]);
font.setCMap(new CMapSegment[]{new CMapSegment('\u0323', '\u0323', 1)});
GlyphClassTable.createClassTable(entries), null);
font.setGDEF(
new GlyphDefinitionTable(Collections.singletonList(table), new HashMap<String, ScriptProcessor>()));
- String actual = font.reorderCombiningMarks(in, null, OTFScript.DEFAULT, null, null).toString();
- Assert.assertEquals(actual.charAt(0), 803);
+ return font;
}
}