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:04 UTC
svn commit: r1914721 - /pdfbox/branches/2.0/fontbox/src/test/java/org/apache/fontbox/ttf/TestCMapSubtable.java
Author: tilman
Date: Sat Dec 16 19:50:03 2023
New Revision: 1914721
URL: http://svn.apache.org/viewvc?rev=1914721&view=rev
Log:
PDFBOX-5741: add test for 4106
Modified:
pdfbox/branches/2.0/fontbox/src/test/java/org/apache/fontbox/ttf/TestCMapSubtable.java
Modified: pdfbox/branches/2.0/fontbox/src/test/java/org/apache/fontbox/ttf/TestCMapSubtable.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/2.0/fontbox/src/test/java/org/apache/fontbox/ttf/TestCMapSubtable.java?rev=1914721&r1=1914720&r2=1914721&view=diff
==============================================================================
--- pdfbox/branches/2.0/fontbox/src/test/java/org/apache/fontbox/ttf/TestCMapSubtable.java (original)
+++ pdfbox/branches/2.0/fontbox/src/test/java/org/apache/fontbox/ttf/TestCMapSubtable.java Sat Dec 16 19:50:03 2023
@@ -56,4 +56,30 @@ public class TestCMapSubtable
Assert.assertEquals(expectedCharCodes, unicodeBmpCharCodes);
Assert.assertEquals(expectedCharCodes, unicodeFullCharCodes);
}
+
+ /**
+ * PDFBOX-4106: getting different gid depending of vertical substitions enabled or not.
+ *
+ * @throws IOException
+ */
+ @Test
+ public void testVerticalSubstitution() throws IOException
+ {
+ File ipaFont = new File("target/fonts/ipag00303", "ipag.ttf");
+ TrueTypeFont ttf = new TTFParser().parse(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);
+ Assert.assertEquals(441, hgid1);
+ Assert.assertEquals(442, hgid2);
+ Assert.assertEquals(7392, vgid1);
+ Assert.assertEquals(7393, vgid2);
+ }
}