You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pdfbox.apache.org by ti...@apache.org on 2023/12/16 19:50:28 UTC
svn commit: r1914723 - /pdfbox/trunk/fontbox/src/test/java/org/apache/fontbox/ttf/TestCMapSubtable.java
Author: tilman
Date: Sat Dec 16 19:50:28 2023
New Revision: 1914723
URL: http://svn.apache.org/viewvc?rev=1914723&view=rev
Log:
PDFBOX-5741: add test for 4106
Modified:
pdfbox/trunk/fontbox/src/test/java/org/apache/fontbox/ttf/TestCMapSubtable.java
Modified: pdfbox/trunk/fontbox/src/test/java/org/apache/fontbox/ttf/TestCMapSubtable.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/fontbox/src/test/java/org/apache/fontbox/ttf/TestCMapSubtable.java?rev=1914723&r1=1914722&r2=1914723&view=diff
==============================================================================
--- pdfbox/trunk/fontbox/src/test/java/org/apache/fontbox/ttf/TestCMapSubtable.java (original)
+++ pdfbox/trunk/fontbox/src/test/java/org/apache/fontbox/ttf/TestCMapSubtable.java Sat Dec 16 19:50:28 2023
@@ -58,4 +58,30 @@ class TestCMapSubtable
Assertions.assertEquals(expectedCharCodes, unicodeBmpCharCodes);
Assertions.assertEquals(expectedCharCodes, unicodeFullCharCodes);
}
+
+ /**
+ * PDFBOX-4106: getting different gid depending of vertical substitions enabled or not.
+ *
+ * @throws IOException
+ */
+ @Test
+ void testVerticalSubstitution() throws IOException
+ {
+ File ipaFont = new File("target/fonts/ipag00303", "ipag.ttf");
+ TrueTypeFont ttf = new TTFParser().parse(new RandomAccessReadBufferedFile(ipaFont));
+
+ CmapLookup unicodeCmapLookup1 = ttf.getUnicodeCmapLookup();
+ int hgid1 = unicodeCmapLookup1.getGlyphId('ã');
+ int hgid2 = unicodeCmapLookup1.getGlyphId('ã');
+ ttf.enableVerticalSubstitutions();
+ CmapLookup unicodeCmapLookup2 = ttf.getUnicodeCmapLookup();
+ int vgid1 = unicodeCmapLookup2.getGlyphId('ã');
+ int vgid2 = unicodeCmapLookup2.getGlyphId('ã');
+ System.out.println(hgid1 + " " + hgid2);
+ System.out.println(vgid1 + " " + vgid2);
+ Assertions.assertEquals(441, hgid1);
+ Assertions.assertEquals(442, hgid2);
+ Assertions.assertEquals(7392, vgid1);
+ Assertions.assertEquals(7393, vgid2);
+ }
}