From c54cb7efe6d808e67882930e828e3bd89ee976b9 Mon Sep 17 00:00:00 2001 From: Glenn Adams Date: Mon, 13 Oct 2014 20:57:22 +0000 Subject: FOP-2416: add support for Arabic Joiners (ZWJ/ZWNJ) - preliminary git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1631546 13f79535-47bb-0310-9956-ffa450edef68 --- .../complexscripts/scripts/ScriptsTestSuite.java | 8 +- .../scripts/arabic/ArabicJoinersTestCase.java | 138 +++++++++++++++ .../scripts/arabic/ArabicTestCase.java | 191 --------------------- .../scripts/arabic/ArabicTestConstants.java | 49 ------ .../scripts/arabic/ArabicWordFormsConstants.java | 49 ++++++ .../scripts/arabic/ArabicWordFormsTestCase.java | 191 +++++++++++++++++++++ .../scripts/arabic/GenerateArabicTestData.java | 2 +- 7 files changed, 385 insertions(+), 243 deletions(-) create mode 100644 test/java/org/apache/fop/complexscripts/scripts/arabic/ArabicJoinersTestCase.java delete mode 100644 test/java/org/apache/fop/complexscripts/scripts/arabic/ArabicTestCase.java delete mode 100644 test/java/org/apache/fop/complexscripts/scripts/arabic/ArabicTestConstants.java create mode 100644 test/java/org/apache/fop/complexscripts/scripts/arabic/ArabicWordFormsConstants.java create mode 100644 test/java/org/apache/fop/complexscripts/scripts/arabic/ArabicWordFormsTestCase.java (limited to 'test') diff --git a/test/java/org/apache/fop/complexscripts/scripts/ScriptsTestSuite.java b/test/java/org/apache/fop/complexscripts/scripts/ScriptsTestSuite.java index c48be5220..27914450a 100644 --- a/test/java/org/apache/fop/complexscripts/scripts/ScriptsTestSuite.java +++ b/test/java/org/apache/fop/complexscripts/scripts/ScriptsTestSuite.java @@ -23,12 +23,16 @@ import org.junit.runner.RunWith; import org.junit.runners.Suite; import org.junit.runners.Suite.SuiteClasses; -import org.apache.fop.complexscripts.scripts.arabic.ArabicTestCase; +import org.apache.fop.complexscripts.scripts.arabic.ArabicJoinersTestCase; +import org.apache.fop.complexscripts.scripts.arabic.ArabicWordFormsTestCase; /** * Test suite for script specific functionality related to complex scripts. */ @RunWith(Suite.class) -@SuiteClasses(ArabicTestCase.class) +@SuiteClasses({ + ArabicJoinersTestCase.class, + ArabicWordFormsTestCase.class +}) public class ScriptsTestSuite { } diff --git a/test/java/org/apache/fop/complexscripts/scripts/arabic/ArabicJoinersTestCase.java b/test/java/org/apache/fop/complexscripts/scripts/arabic/ArabicJoinersTestCase.java new file mode 100644 index 000000000..092bebd41 --- /dev/null +++ b/test/java/org/apache/fop/complexscripts/scripts/arabic/ArabicJoinersTestCase.java @@ -0,0 +1,138 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* $Id$ */ + +package org.apache.fop.complexscripts.scripts.arabic; + +import java.nio.IntBuffer; +import java.util.BitSet; + +import org.junit.Test; + +import static org.junit.Assert.assertTrue; + +import org.apache.fop.complexscripts.scripts.ScriptProcessor; +import org.apache.fop.complexscripts.util.CharScript; +import org.apache.fop.complexscripts.util.GlyphContextTester; +import org.apache.fop.complexscripts.util.GlyphSequence; +import org.apache.fop.complexscripts.util.ScriptContextTester; +import org.apache.fop.complexscripts.util.UTF32; + +// CSOFF: LineLength + +/** + * Tests for joiner (ZWJ, ZWNJ) functionality related to the arabic script. + */ +public class ArabicJoinersTestCase { + + private static final String[][] ZWJ_TESTS_ISOL = new String[][] { + { "\u0643", "1", }, + { "\u0643\u200D", "00", }, + { "\u200D\u0643", "00", }, + { "\u200D\u0643\u200D", "000", }, + }; + + private static final String[][] ZWJ_TESTS_INIT = new String[][] { + { "\u0643", "0", }, + { "\u0643\u200D", "10", }, + { "\u200D\u0643", "00", }, + { "\u200D\u0643\u200D", "000", }, + }; + + private static final String[][] ZWJ_TESTS_MEDI = new String[][] { + { "\u0643", "0", }, + { "\u0643\u200D", "00", }, + { "\u200D\u0643", "00", }, + { "\u200D\u0643\u200D", "010", }, + }; + + private static final String[][] ZWJ_TESTS_FINA = new String[][] { + { "\u0643", "0", }, + { "\u0643\u200D", "00", }, + { "\u200D\u0643", "01", }, + { "\u200D\u0643\u200D", "000", }, + }; + + private static final String[][] ZWJ_TESTS_LIGA = new String[][] { + }; + + @Test + public void testArabicJoiners() { + String script = CharScript.scriptTagFromCode(CharScript.SCRIPT_ARABIC); + ScriptProcessor sp = ScriptProcessor.getInstance(script); + assertTrue(sp != null); + ScriptContextTester sct = sp.getSubstitutionContextTester(); + assertTrue(sct != null); + String language = "dflt"; + int flags = 0; + testZWJ(sct, script, language, "isol", flags, ZWJ_TESTS_ISOL); + testZWJ(sct, script, language, "init", flags, ZWJ_TESTS_INIT); + testZWJ(sct, script, language, "medi", flags, ZWJ_TESTS_MEDI); + testZWJ(sct, script, language, "fina", flags, ZWJ_TESTS_FINA); + testZWJ(sct, script, language, "liga", flags, ZWJ_TESTS_LIGA); + } + + private void testZWJ(ScriptContextTester sct, String script, String language, String feature, int flags, String[][] tests) { + GlyphContextTester gct = sct.getTester(feature); + assertTrue(gct != null); + for (String[] t : tests) { + testZWJ(gct, script, language, feature, flags, t); + } + } + + private void testZWJ(GlyphContextTester gct, String script, String language, String feature, int flags, String[] test) { + assert test.length == 2; + String str = test[0]; + BitSet act = new BitSet(); + GlyphSequence gs = makeGlyphSequence(str); + for (int i = 0, n = str.length(); i < n; ++i) { + if (gct.test(script, language, feature, gs, i, flags)) { + act.set(i); + } + } + BitSet exp = parseBitSet(test[1]); + assertTrue(act.equals(exp)); + } + + private GlyphSequence makeGlyphSequence(String s) { + Integer[] ca = UTF32.toUTF32(s, 0, true); + IntBuffer cb = IntBuffer.allocate(ca.length); + for (Integer c : ca) { + cb.put(c); + } + cb.rewind(); + return new GlyphSequence(cb, null, null); + } + + private BitSet parseBitSet(String s) { + BitSet bits = new BitSet(); + for (int i = 0, n = s.length(); i < n; ++i) { + char c = s.charAt(i); + assert (c == '0') || (c == '1'); + if (c == '1') { + bits.set(i); + } + } + return bits; + } + + @Test + public void testArabicNonJoiners() { + } + +} diff --git a/test/java/org/apache/fop/complexscripts/scripts/arabic/ArabicTestCase.java b/test/java/org/apache/fop/complexscripts/scripts/arabic/ArabicTestCase.java deleted file mode 100644 index 8542faae9..000000000 --- a/test/java/org/apache/fop/complexscripts/scripts/arabic/ArabicTestCase.java +++ /dev/null @@ -1,191 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* $Id$ */ - -package org.apache.fop.complexscripts.scripts.arabic; - -import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.FilenameFilter; -import java.io.IOException; -import java.io.ObjectInputStream; -import java.nio.IntBuffer; -import java.util.List; - -import org.junit.Test; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; - -import org.apache.fop.complexscripts.fonts.GlyphPositioningTable; -import org.apache.fop.complexscripts.fonts.GlyphSubstitutionTable; -import org.apache.fop.complexscripts.fonts.ttx.TTXFile; -import org.apache.fop.complexscripts.util.GlyphSequence; - -// CSOFF: LineLength - -/** - * Tests for functionality related to the arabic script. - */ -public class ArabicTestCase implements ArabicTestConstants { - - @Test - public void testArabicWordForms() { - for (String sfn : SRC_FILES) { - try { - processWordForms(new File(DAT_FILES_DIR)); - } catch (Exception e) { - fail(e.getMessage()); - } - } - } - - private void processWordForms(File dfd) { - String[] files = listWordFormFiles(dfd); - for (String fn : files) { - File dff = new File(dfd, fn); - processWordForms(dff.getAbsolutePath()); - } - } - - private String[] listWordFormFiles(File dfd) { - return dfd.list(new FilenameFilter() { - public boolean accept(File f, String name) { - return hasPrefixFrom(name, SRC_FILES) && hasExtension(name, WF_FILE_DAT_EXT); - } - private boolean hasPrefixFrom(String name, String[] prefixes) { - for (String p : prefixes) { - if (name.startsWith(p)) { - return true; - } - } - return false; - } - private boolean hasExtension(String name, String extension) { - return name.endsWith("." + extension); - } - }); - } - - private void processWordForms(String dpn) { - FileInputStream fis = null; - try { - fis = new FileInputStream(dpn); - if (fis != null) { - ObjectInputStream ois = new ObjectInputStream(fis); - List data = (List) ois.readObject(); - if (data != null) { - processWordForms(data); - } - ois.close(); - } - } catch (FileNotFoundException e) { - throw new RuntimeException(e.getMessage(), e); - } catch (IOException e) { - throw new RuntimeException(e.getMessage(), e); - } catch (Exception e) { - throw new RuntimeException(e.getMessage(), e); - } finally { - if (fis != null) { - try { fis.close(); } catch (Exception e) { /* NOP */ } - } - } - } - - private void processWordForms(List data) { - assert data != null; - assert data.size() > 0; - String script = null; - String language = null; - String tfn = null; - TTXFile tf = null; - GlyphSubstitutionTable gsub = null; - GlyphPositioningTable gpos = null; - int[] widths = null; - for (Object[] d : data) { - if (script == null) { - assert d.length >= 4; - script = (String) d[0]; - language = (String) d[1]; - tfn = (String) d[3]; - tf = TTXFile.getFromCache(TTX_FONTS_DIR + File.separator + tfn); - assertTrue(tf != null); - gsub = tf.getGSUB(); - assertTrue(gsub != null); - gpos = tf.getGPOS(); - assertTrue(gpos != null); - widths = tf.getWidths(); - assertTrue(widths != null); - } else { - assert tf != null; - assert gsub != null; - assert gpos != null; - assert tfn != null; - assert d.length >= 4; - String wf = (String) d[0]; - int[] iga = (int[]) d[1]; - int[] oga = (int[]) d[2]; - int[][] paa = (int[][]) d[3]; - GlyphSequence tigs = tf.mapCharsToGlyphs(wf); - assertSameGlyphs(iga, getGlyphs(tigs), "input glyphs", wf, tfn); - GlyphSequence togs = gsub.substitute(tigs, script, language); - assertSameGlyphs(oga, getGlyphs(togs), "output glyphs", wf, tfn); - int[][] tpaa = new int [ togs.getGlyphCount() ] [ 4 ]; - if (gpos.position(togs, script, language, 1000, widths, tpaa)) { - assertSameAdjustments(paa, tpaa, wf, tfn); - } else if (paa != null) { - assertEquals("unequal adjustment count, word form(" + wf + "), font (" + tfn + ")", paa.length, 0); - } - } - } - } - - private void assertSameGlyphs(int[] expected, int[] actual, String label, String wf, String tfn) { - assertEquals(label + ": unequal glyph count, word form(" + wf + "), font (" + tfn + ")", expected.length, actual.length); - for (int i = 0, n = expected.length; i < n; i++) { - int e = expected[i]; - int a = actual[i]; - assertEquals(label + ": unequal glyphs[" + i + "], word form(" + wf + "), font (" + tfn + ")", e, a); - } - } - - private void assertSameAdjustments(int[][] expected, int[][] actual, String wf, String tfn) { - assertEquals("unequal adjustment count, word form(" + wf + "), font (" + tfn + ")", expected.length, actual.length); - for (int i = 0, n = expected.length; i < n; i++) { - int[] ea = expected[i]; - int[] aa = actual[i]; - assertEquals("bad adjustments length, word form(" + wf + "), font (" + tfn + ")", ea.length, aa.length); - for (int k = 0; k < 4; k++) { - int e = ea[k]; - int a = aa[k]; - assertEquals("unequal adjustment[" + i + "][" + k + "], word form(" + wf + "), font (" + tfn + ")", e, a); - } - } - } - - private static int[] getGlyphs(GlyphSequence gs) { - IntBuffer gb = gs.getGlyphs(); - int[] ga = new int [ gb.limit() ]; - gb.rewind(); - gb.get(ga); - return ga; - } - -} diff --git a/test/java/org/apache/fop/complexscripts/scripts/arabic/ArabicTestConstants.java b/test/java/org/apache/fop/complexscripts/scripts/arabic/ArabicTestConstants.java deleted file mode 100644 index cc9167553..000000000 --- a/test/java/org/apache/fop/complexscripts/scripts/arabic/ArabicTestConstants.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* $Id$ */ - -package org.apache.fop.complexscripts.scripts.arabic; - -/** - * Constants for test functionality related to the arabic script. - */ -public interface ArabicTestConstants { - - String WF_FILE_SCRIPT = "arab"; - String WF_FILE_LANGUAGE = "dflt"; - - String SRC_FILES_DIR = "test/resources/complexscripts/arab/data"; - String DAT_FILES_DIR = "test/resources/complexscripts/arab/data"; - - String[] SRC_FILES = { - "arab-001", // unpointed word forms - }; - - String WF_FILE_SRC_EXT = "txt"; - String WF_FILE_DAT_EXT = "ser"; - - String TTX_FONTS_DIR = "test/resources/complexscripts/arab/ttx"; - - String[] TTX_FONTS = { - "arab-001.ttx", // simplified arabic - "arab-002.ttx", // traditional arabic - "arab-003.ttx", // lateef - "arab-004.ttx", // scheherazade - }; - -} diff --git a/test/java/org/apache/fop/complexscripts/scripts/arabic/ArabicWordFormsConstants.java b/test/java/org/apache/fop/complexscripts/scripts/arabic/ArabicWordFormsConstants.java new file mode 100644 index 000000000..41094b687 --- /dev/null +++ b/test/java/org/apache/fop/complexscripts/scripts/arabic/ArabicWordFormsConstants.java @@ -0,0 +1,49 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* $Id$ */ + +package org.apache.fop.complexscripts.scripts.arabic; + +/** + * Constants for test functionality related to the arabic script. + */ +public interface ArabicWordFormsConstants { + + String WF_FILE_SCRIPT = "arab"; + String WF_FILE_LANGUAGE = "dflt"; + + String SRC_FILES_DIR = "test/resources/complexscripts/arab/data"; + String DAT_FILES_DIR = "test/resources/complexscripts/arab/data"; + + String[] SRC_FILES = { + "arab-001", // unpointed word forms + }; + + String WF_FILE_SRC_EXT = "txt"; + String WF_FILE_DAT_EXT = "ser"; + + String TTX_FONTS_DIR = "test/resources/complexscripts/arab/ttx"; + + String[] TTX_FONTS = { + "arab-001.ttx", // simplified arabic + "arab-002.ttx", // traditional arabic + "arab-003.ttx", // lateef + "arab-004.ttx", // scheherazade + }; + +} diff --git a/test/java/org/apache/fop/complexscripts/scripts/arabic/ArabicWordFormsTestCase.java b/test/java/org/apache/fop/complexscripts/scripts/arabic/ArabicWordFormsTestCase.java new file mode 100644 index 000000000..abe4f513a --- /dev/null +++ b/test/java/org/apache/fop/complexscripts/scripts/arabic/ArabicWordFormsTestCase.java @@ -0,0 +1,191 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* $Id$ */ + +package org.apache.fop.complexscripts.scripts.arabic; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.FilenameFilter; +import java.io.IOException; +import java.io.ObjectInputStream; +import java.nio.IntBuffer; +import java.util.List; + +import org.junit.Test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import org.apache.fop.complexscripts.fonts.GlyphPositioningTable; +import org.apache.fop.complexscripts.fonts.GlyphSubstitutionTable; +import org.apache.fop.complexscripts.fonts.ttx.TTXFile; +import org.apache.fop.complexscripts.util.GlyphSequence; + +// CSOFF: LineLength + +/** + * Tests for functionality related to the arabic script. + */ +public class ArabicWordFormsTestCase implements ArabicWordFormsConstants { + + @Test + public void testArabicWordForms() { + for (String sfn : SRC_FILES) { + try { + processWordForms(new File(DAT_FILES_DIR)); + } catch (Exception e) { + fail(e.getMessage()); + } + } + } + + private void processWordForms(File dfd) { + String[] files = listWordFormFiles(dfd); + for (String fn : files) { + File dff = new File(dfd, fn); + processWordForms(dff.getAbsolutePath()); + } + } + + private String[] listWordFormFiles(File dfd) { + return dfd.list(new FilenameFilter() { + public boolean accept(File f, String name) { + return hasPrefixFrom(name, SRC_FILES) && hasExtension(name, WF_FILE_DAT_EXT); + } + private boolean hasPrefixFrom(String name, String[] prefixes) { + for (String p : prefixes) { + if (name.startsWith(p)) { + return true; + } + } + return false; + } + private boolean hasExtension(String name, String extension) { + return name.endsWith("." + extension); + } + }); + } + + private void processWordForms(String dpn) { + FileInputStream fis = null; + try { + fis = new FileInputStream(dpn); + if (fis != null) { + ObjectInputStream ois = new ObjectInputStream(fis); + List data = (List) ois.readObject(); + if (data != null) { + processWordForms(data); + } + ois.close(); + } + } catch (FileNotFoundException e) { + throw new RuntimeException(e.getMessage(), e); + } catch (IOException e) { + throw new RuntimeException(e.getMessage(), e); + } catch (Exception e) { + throw new RuntimeException(e.getMessage(), e); + } finally { + if (fis != null) { + try { fis.close(); } catch (Exception e) { /* NOP */ } + } + } + } + + private void processWordForms(List data) { + assert data != null; + assert data.size() > 0; + String script = null; + String language = null; + String tfn = null; + TTXFile tf = null; + GlyphSubstitutionTable gsub = null; + GlyphPositioningTable gpos = null; + int[] widths = null; + for (Object[] d : data) { + if (script == null) { + assert d.length >= 4; + script = (String) d[0]; + language = (String) d[1]; + tfn = (String) d[3]; + tf = TTXFile.getFromCache(TTX_FONTS_DIR + File.separator + tfn); + assertTrue(tf != null); + gsub = tf.getGSUB(); + assertTrue(gsub != null); + gpos = tf.getGPOS(); + assertTrue(gpos != null); + widths = tf.getWidths(); + assertTrue(widths != null); + } else { + assert tf != null; + assert gsub != null; + assert gpos != null; + assert tfn != null; + assert d.length >= 4; + String wf = (String) d[0]; + int[] iga = (int[]) d[1]; + int[] oga = (int[]) d[2]; + int[][] paa = (int[][]) d[3]; + GlyphSequence tigs = tf.mapCharsToGlyphs(wf); + assertSameGlyphs(iga, getGlyphs(tigs), "input glyphs", wf, tfn); + GlyphSequence togs = gsub.substitute(tigs, script, language); + assertSameGlyphs(oga, getGlyphs(togs), "output glyphs", wf, tfn); + int[][] tpaa = new int [ togs.getGlyphCount() ] [ 4 ]; + if (gpos.position(togs, script, language, 1000, widths, tpaa)) { + assertSameAdjustments(paa, tpaa, wf, tfn); + } else if (paa != null) { + assertEquals("unequal adjustment count, word form(" + wf + "), font (" + tfn + ")", paa.length, 0); + } + } + } + } + + private void assertSameGlyphs(int[] expected, int[] actual, String label, String wf, String tfn) { + assertEquals(label + ": unequal glyph count, word form(" + wf + "), font (" + tfn + ")", expected.length, actual.length); + for (int i = 0, n = expected.length; i < n; i++) { + int e = expected[i]; + int a = actual[i]; + assertEquals(label + ": unequal glyphs[" + i + "], word form(" + wf + "), font (" + tfn + ")", e, a); + } + } + + private void assertSameAdjustments(int[][] expected, int[][] actual, String wf, String tfn) { + assertEquals("unequal adjustment count, word form(" + wf + "), font (" + tfn + ")", expected.length, actual.length); + for (int i = 0, n = expected.length; i < n; i++) { + int[] ea = expected[i]; + int[] aa = actual[i]; + assertEquals("bad adjustments length, word form(" + wf + "), font (" + tfn + ")", ea.length, aa.length); + for (int k = 0; k < 4; k++) { + int e = ea[k]; + int a = aa[k]; + assertEquals("unequal adjustment[" + i + "][" + k + "], word form(" + wf + "), font (" + tfn + ")", e, a); + } + } + } + + private static int[] getGlyphs(GlyphSequence gs) { + IntBuffer gb = gs.getGlyphs(); + int[] ga = new int [ gb.limit() ]; + gb.rewind(); + gb.get(ga); + return ga; + } + +} diff --git a/test/java/org/apache/fop/complexscripts/scripts/arabic/GenerateArabicTestData.java b/test/java/org/apache/fop/complexscripts/scripts/arabic/GenerateArabicTestData.java index 9ca16a164..35bfb3128 100644 --- a/test/java/org/apache/fop/complexscripts/scripts/arabic/GenerateArabicTestData.java +++ b/test/java/org/apache/fop/complexscripts/scripts/arabic/GenerateArabicTestData.java @@ -40,7 +40,7 @@ import org.apache.fop.complexscripts.util.GlyphSequence; /** * Tests for functionality related to the arabic script. */ -public final class GenerateArabicTestData implements ArabicTestConstants { +public final class GenerateArabicTestData implements ArabicWordFormsConstants { private GenerateArabicTestData() { } -- cgit v1.2.3