Author: tilman
Date: Thu Oct 23 11:23:08 2025
New Revision: 1929306
Log:
PDFBOX-6085: check that the correct font version is used
Modified:
pdfbox/branches/2.0/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/font/TestFontEmbedding.java
Modified:
pdfbox/branches/2.0/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/font/TestFontEmbedding.java
==============================================================================
---
pdfbox/branches/2.0/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/font/TestFontEmbedding.java
Thu Oct 23 11:22:24 2025 (r1929305)
+++
pdfbox/branches/2.0/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/font/TestFontEmbedding.java
Thu Oct 23 11:23:08 2025 (r1929306)
@@ -515,8 +515,8 @@ public class TestFontEmbedding extends T
/**
* PDFBOX-6085: test with the Noto font, this one has a zero width GID
between other GIDs and
- * failed in the past. This "fails before the fix" only with the version
2.004, size 204.336
- * Bytes.
+ * failed in the past. This "fails before the fix" only with the version
2.004,
+ * size 204336 bytes.
*
* @throws IOException
*/
@@ -535,6 +535,14 @@ public class TestFontEmbedding extends T
InputStream is = TestFontEmbedding.class.getResourceAsStream(
"/org/apache/pdfbox/ttf/NotoSansDevanagari-Regular.ttf");
PDType0Font font = PDType0Font.load(doc, is);
+
+ // check that we're using the correct font version. The newer font has
a different glyph ordering.
+ byte[] encoded = font.encode("A\u200c");
+ int val1 = (encoded[0] << 8) + (encoded[1] & 0xff);
+ int val2 = (encoded[2] << 8) + (encoded[3] & 0xff);
+ assertEquals(960, val1);
+ assertEquals(132, val2);
+
String s = new String(codepoints, 0, codepoints.length);
cs.beginText();
cs.newLineAtOffset(20, 800);