[ 
https://issues.apache.org/jira/browse/PDFBOX-3708?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15896159#comment-15896159
 ] 

ASF subversion and git services commented on PDFBOX-3708:
---------------------------------------------------------

Commit 1785538 from [~tilman] in branch 'pdfbox/trunk'
[ https://svn.apache.org/r1785538 ]

PDFBOX-3708: clarify javadoc

> 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"));
>         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: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to