Author: tilman
Date: Wed Aug 20 18:40:57 2025
New Revision: 1927919
Log:
PDFBOX-5660: improve test coverage (Symbol Standard 14 font)
Modified:
pdfbox/branches/2.0/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/font/PDFontTest.java
Modified:
pdfbox/branches/2.0/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/font/PDFontTest.java
==============================================================================
---
pdfbox/branches/2.0/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/font/PDFontTest.java
Wed Aug 20 18:39:27 2025 (r1927918)
+++
pdfbox/branches/2.0/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/font/PDFontTest.java
Wed Aug 20 18:40:57 2025 (r1927919)
@@ -408,7 +408,9 @@ public class PDFontTest
}
/**
- * PDFBOX-5115: U+00AD (soft hyphen) should work with WinAnsiEncoding.
+ * PDFBOX-5115: U+00AD (soft hyphen) should work with WinAnsiEncoding.
+ *
+ * @throws IOException
*/
@Test
public void testSoftHyphen() throws IOException
@@ -500,4 +502,31 @@ public class PDFontTest
Assert.assertEquals(278.0f, font.getSpaceWidth(), 0.001f);
document.close();
}
+
+ @Test
+ public void testSymbol() throws IOException
+ {
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+
+ PDDocument doc = new PDDocument();
+ PDPage page = new PDPage();
+ PDPageContentStream contentStream = new PDPageContentStream(doc, page);
+ contentStream.beginText();
+ contentStream.setFont(PDType1Font.SYMBOL, 10);
+ contentStream.newLineAtOffset(10, 700);
+ // Note that the Alpha is the greek alpha, but the Omega is the Ohm
symbol
+ // (Tested on Windows)
+ contentStream.showText("\u0391 \u2126");
+ contentStream.endText();
+ contentStream.close();
+ doc.addPage(page);
+ doc.save(baos);
+ doc.close();
+
+ doc = PDDocument.load(baos.toByteArray());
+ PDFTextStripper stripper = new PDFTextStripper();
+ String text = stripper.getText(doc);
+ Assert.assertEquals("\u0391 \u2126", text.trim());
+ doc.close();
+ }
}