Tilman Hausherr created PDFBOX-3708:
---------------------------------------
Summary: hasGlyph() contradicts encode()
Key: PDFBOX-3708
URL: https://issues.apache.org/jira/browse/PDFBOX-3708
Project: PDFBox
Issue Type: Bug
Affects Versions: 2.0.4, 2.1.0
Reporter: Tilman Hausherr
{code}
PDDocument doc = new PDDocument();
PDType0Font font = PDType0Font.load(doc, new
FileInputStream("c:/windows/fonts/arial.ttf"), false);
System.out.println(font.hasGlyph('\n'));
PDPage page = new PDPage();
doc.addPage(page);
PDPageContentStream cs = new PDPageContentStream(doc, page);
cs.beginText();
cs.setFont(font, 100);
cs.showText("\n");
{code}
The output:
{code}
true
Exception in thread "main" java.lang.IllegalArgumentException: No glyph for
U+000A in font ArialMT
at
org.apache.pdfbox.pdmodel.font.PDCIDFontType2.encode(PDCIDFontType2.java:402)
at
org.apache.pdfbox.pdmodel.font.PDType0Font.encode(PDType0Font.java:351)
at org.apache.pdfbox.pdmodel.font.PDFont.encode(PDFont.java:316)
at
org.apache.pdfbox.pdmodel.PDPageContentStream.showText(PDPageContentStream.java:362)
{code}
Either this is a bug in hasGlyph(), or it is a documentation problem, e.g.
because the parameter to hasGlyph isn't a character code but something else.
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]