From b84af21020a5f875ad6e07439870696049e7bcda Mon Sep 17 00:00:00 2001 From: Simon Steiner Date: Thu, 16 Jun 2022 12:34:17 +0000 Subject: [PATCH] FOP-3078: Fix position of macron glyph git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1901965 13f79535-47bb-0310-9956-ffa450edef68 --- .../complexscripts/scripts/DefaultScriptProcessor.java | 3 ++- .../complexscripts/scripts/DefaultScriptTestCase.java | 9 +++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/fop-core/src/main/java/org/apache/fop/complexscripts/scripts/DefaultScriptProcessor.java b/fop-core/src/main/java/org/apache/fop/complexscripts/scripts/DefaultScriptProcessor.java index 0de1a2058..11f20eaf3 100644 --- a/fop-core/src/main/java/org/apache/fop/complexscripts/scripts/DefaultScriptProcessor.java +++ b/fop-core/src/main/java/org/apache/fop/complexscripts/scripts/DefaultScriptProcessor.java @@ -153,7 +153,8 @@ public class DefaultScriptProcessor extends ScriptProcessor { 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; + int paindex = Math.min(pa.length - 1, index); + return gdef.isGlyphClass(glyphs[index], GlyphDefinitionTable.GLYPH_CLASS_MARK) && pa[paindex] != 0; } } diff --git a/fop-core/src/test/java/org/apache/fop/complexscripts/scripts/DefaultScriptTestCase.java b/fop-core/src/test/java/org/apache/fop/complexscripts/scripts/DefaultScriptTestCase.java index b8357068b..b1439a0ba 100644 --- a/fop-core/src/test/java/org/apache/fop/complexscripts/scripts/DefaultScriptTestCase.java +++ b/fop-core/src/test/java/org/apache/fop/complexscripts/scripts/DefaultScriptTestCase.java @@ -52,6 +52,15 @@ public class DefaultScriptTestCase { Assert.assertEquals(actual.charAt(0), 57344); } + @Test + public void testProcessorReorder2() { + String in = "\u00F6\u0323"; + int[][] gpa = new int[2][2]; + gpa[1][1] = 1; + String actual = getFont().reorderCombiningMarks(in, gpa, OTFScript.DEFAULT, null, null).toString(); + Assert.assertEquals(actual.charAt(0), 803); + } + private MultiByteFont getFont() { MultiByteFont font = new MultiByteFont(null, null); font.setWidthArray(new int[0]); -- 2.39.5