Skip to content

Commit 97cbaa0

Browse files
committed
PDFBOX-5660: improve test coverage (Symbol Standard 14 font)
git-svn-id: https://svn.apache.org/repos/asf/pdfbox/trunk@1927917 13f79535-47bb-0310-9956-ffa450edef68
1 parent 0de1023 commit 97cbaa0

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

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

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -498,4 +498,35 @@ void PDFBOX5920TrueType() throws IOException
498498
assertEquals(278.0f, font.getSpaceWidth());
499499
}
500500
}
501+
502+
@Test
503+
void testSymbol() throws IOException
504+
{
505+
ByteArrayOutputStream baos = new ByteArrayOutputStream();
506+
try (PDDocument doc = new PDDocument())
507+
{
508+
PDPage page = new PDPage();
509+
try (PDPageContentStream contentStream = new PDPageContentStream(doc, page))
510+
{
511+
PDType1Font font = new PDType1Font(FontName.SYMBOL);
512+
513+
contentStream.beginText();
514+
contentStream.setFont(font, 10);
515+
contentStream.newLineAtOffset(10, 700);
516+
// Note that the Alpha is the greek alpha, but the Omega is the Ohm symbol
517+
// (Tested on Windows)
518+
contentStream.showText("\u0391 \u2126");
519+
contentStream.endText();
520+
}
521+
522+
doc.addPage(page);
523+
doc.save(baos);
524+
}
525+
try (PDDocument doc = Loader.loadPDF(baos.toByteArray()))
526+
{
527+
PDFTextStripper stripper = new PDFTextStripper();
528+
String text = stripper.getText(doc);
529+
assertEquals("\u0391 \u2126", text.trim());
530+
}
531+
}
501532
}

0 commit comments

Comments
 (0)