You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "Tilman Hausherr (JIRA)" <ji...@apache.org> on 2017/03/05 10:30:33 UTC
[jira] [Resolved] (PDFBOX-3708) hasGlyph() contradicts encode()
[ https://issues.apache.org/jira/browse/PDFBOX-3708?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Tilman Hausherr resolved PDFBOX-3708.
-------------------------------------
Resolution: Fixed
Fix Version/s: 2.1.0
2.0.5
Thanks!
> 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
> Fix For: 2.0.5, 2.1.0
>
>
> {code}
> PDDocument doc = new PDDocument();
> PDType0Font font = PDType0Font.load(doc, new FileInputStream("c:/windows/fonts/arial.ttf"));
> 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 (javadoc) problem, e.g. because the parameter to hasGlyph isn't a character code but something else, then this should be clarified.
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: dev-help@pdfbox.apache.org