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 2020/01/21 16:30:00 UTC

[jira] [Commented] (PDFBOX-4748) No glyph problem

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

Tilman Hausherr commented on PDFBOX-4748:
-----------------------------------------

hasGlyph() doesn't work that way, see its javadoc: "character code in a PDF. Not to be confused with unicode".

For the better strategy, see the EmbeddedMultipleFonts.java example. tl;dr: we catch IllegalArgumentException.

> No glyph problem
> ----------------
>
>                 Key: PDFBOX-4748
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-4748
>             Project: PDFBox
>          Issue Type: Bug
>          Components: PDModel
>    Affects Versions: 2.0.18
>            Reporter: Barta Tamás
>            Priority: Major
>
> Hi!
> I load "SourceSansPro-Light" font this way:
> PDType0Font font = PDType0Font.load(FONT_SANS_PRO_LIGHT));
> When I generating PDF I check every character if valid for this font. With character 'ǻ' the font.hasGlyph method returns true so I keep this character, but calling  font.getStringWidth(line) throws the following exception:
> "No glyph for U+01FB (ǻ) in font SourceSansPro-Light"
> I think it seems a bug. Can you fix it or should I change something to work?
>  
>  
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: dev-help@pdfbox.apache.org