diff options
author | Matthias Reischenbacher <matthias@apache.org> | 2018-05-10 14:30:38 +0000 |
---|---|---|
committer | Matthias Reischenbacher <matthias@apache.org> | 2018-05-10 14:30:38 +0000 |
commit | 6add9bfc3ecf09f50b49dacc11456586e68773dc (patch) | |
tree | 45e7769fc781c7ce428fbd9410211139da43e88d /fop-core/src/main | |
parent | f24243e01f0e8bc0e1aec2c8c263c8215561e099 (diff) | |
download | xmlgraphics-fop-6add9bfc3ecf09f50b49dacc11456586e68773dc.tar.gz xmlgraphics-fop-6add9bfc3ecf09f50b49dacc11456586e68773dc.zip |
FOP-2572: fix ArrayIndexOutOfBoundsException if font supports kerninig
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1831346 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'fop-core/src/main')
-rw-r--r-- | fop-core/src/main/java/org/apache/fop/svg/font/FOPGVTGlyphVector.java | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/fop-core/src/main/java/org/apache/fop/svg/font/FOPGVTGlyphVector.java b/fop-core/src/main/java/org/apache/fop/svg/font/FOPGVTGlyphVector.java index 3447f4a24..106469258 100644 --- a/fop-core/src/main/java/org/apache/fop/svg/font/FOPGVTGlyphVector.java +++ b/fop-core/src/main/java/org/apache/fop/svg/font/FOPGVTGlyphVector.java @@ -89,7 +89,7 @@ public class FOPGVTGlyphVector implements GVTGlyphVector { public void performDefaultLayout() { Font f = font.getFont(); MinOptMax letterSpaceIPD = MinOptMax.ZERO; - MinOptMax[] letterSpaceAdjustments = new MinOptMax[text.getEndIndex() - text.getBeginIndex()]; + MinOptMax[] letterSpaceAdjustments = new MinOptMax[text.getEndIndex()]; boolean retainControls = false; GlyphMapping mapping = GlyphMapping.doGlyphMapping(text, text.getBeginIndex(), text.getEndIndex(), f, letterSpaceIPD, letterSpaceAdjustments, '\0', '\0', @@ -99,6 +99,13 @@ public class FOPGVTGlyphVector implements GVTGlyphVector { this.glyphs = buildGlyphs(f, glyphAsCharIter); this.associations = mapping.associations; this.gposAdjustments = mapping.gposAdjustments; + if (text.getBeginIndex() > 0) { + int arrlen = text.getEndIndex() - text.getBeginIndex(); + MinOptMax[] letterSpaceAdjustmentsNew = new MinOptMax[arrlen]; + System.arraycopy(letterSpaceAdjustments, text.getBeginIndex(), letterSpaceAdjustmentsNew, + 0, arrlen); + letterSpaceAdjustments = letterSpaceAdjustmentsNew; + } this.positions = buildGlyphPositions(glyphAsCharIter, mapping.gposAdjustments, letterSpaceAdjustments); this.glyphVisibilities = new boolean[this.glyphs.length]; Arrays.fill(glyphVisibilities, true); |