Skip to content

Commit f067f45

Browse files
committed
PDFBOX-6085: check that the correct font version is used
git-svn-id: https://svn.apache.org/repos/asf/pdfbox/trunk@1929307 13f79535-47bb-0310-9956-ffa450edef68
1 parent fb691d3 commit f067f45

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

pdfbox/src/test/java/org/apache/pdfbox/pdmodel/font/TestFontEmbedding.java

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -298,8 +298,8 @@ void testDevanagari() throws IOException
298298

299299
/**
300300
* PDFBOX-6085: test with the Noto font, this one has a zero width GID between other GIDs and
301-
* failed in the past. This "fails before the fix" only with the version 2.004, size 204.336
302-
* Bytes.
301+
* failed in the past. This "fails before the fix" only with the version 2.004,
302+
* size 204336 bytes.
303303
*
304304
* @throws IOException
305305
*/
@@ -322,6 +322,14 @@ void testDevanagari2() throws IOException
322322
{
323323
InputStream is = TestFontEmbedding.class.getResourceAsStream("/org/apache/pdfbox/ttf/NotoSansDevanagari-Regular.ttf");
324324
PDType0Font font = PDType0Font.load(doc, is);
325+
326+
// check that we're using the correct font version. The newer font has a different glyph ordering.
327+
byte[] encoded = font.encode("A\u200c");
328+
int val1 = (encoded[0] << 8) + (encoded[1] & 0xff);
329+
int val2 = (encoded[2] << 8) + (encoded[3] & 0xff);
330+
assertEquals(960, val1);
331+
assertEquals(132, val2);
332+
325333
String s = new String(codepoints, 0, codepoints.length);
326334
cs.beginText();
327335
cs.newLineAtOffset(20, 800);

0 commit comments

Comments
 (0)