Skip to content

Commit 60aadf5

Browse files
FOP-3180: Glyph positions ignored when using a custom font by João André Gonçalves
1 parent f7f3213 commit 60aadf5

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

batik-bridge/src/main/java/org/apache/batik/bridge/GlyphLayout.java

+7-3
Original file line numberDiff line numberDiff line change
@@ -1341,7 +1341,7 @@ protected void doExplicitGlyphLayout() {
13411341
gv.setGlyphTransform(i, glyphTransform);
13421342
}
13431343

1344-
aciIndex += gv.getCharacterCount(i,i);
1344+
aciIndex = getAciIndex(aciIndex, i);
13451345
if (aciIndex >= charMap.length)
13461346
aciIndex = charMap.length-1;
13471347
ch = aci.setIndex(aciIndex+aciStart);
@@ -1435,7 +1435,7 @@ else if (glyphOrientationAngle == 180)
14351435
transparentStart = -1;
14361436
}
14371437
}
1438-
aciIndex += gv.getCharacterCount(i,i);
1438+
aciIndex = getAciIndex(aciIndex, i);
14391439
if (aciIndex >= charMap.length)
14401440
aciIndex = charMap.length-1;
14411441
ch = aci.setIndex(aciIndex+aciStart);
@@ -1451,6 +1451,10 @@ else if (glyphOrientationAngle == 180)
14511451
pathApplied = false;
14521452
}
14531453

1454+
protected int getAciIndex(int aciIndex, int loopIndex) {
1455+
return aciIndex + gv.getCharacterCount(loopIndex, loopIndex);
1456+
}
1457+
14541458
/**
14551459
* Does any spacing adjustments that may have been specified.
14561460
*/
@@ -1886,7 +1890,7 @@ protected void doPathLayout() {
18861890
}
18871891
currentPosition += glyphAdvance;
18881892
glyphOffset += nextGlyphOffset;
1889-
currentChar += gv.getCharacterCount(i,i);
1893+
currentChar = getAciIndex(currentChar, i);
18901894
if (currentChar >= charMap.length)
18911895
currentChar = charMap.length-1;
18921896
ch = aci.setIndex(currentChar+start);

0 commit comments

Comments
 (0)