pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From John Hewson <j...@jahewson.com>
Subject Re: PDFont.getStringWidth() throws IllegalArgumentException
Date Fri, 19 Jun 2015 05:07:50 GMT
> On 16 Jun 2015, at 21:17, Torgeir Veimo <torgeir.veimo@gmail.com> wrote:
> 
> Am trying out PDFBox 2.0.0-SNAPSHOT to get PDF embedding working, but
> am getting exceptions with normal font routines.
> 
> On the string
> "fagområder som: • skatterådgivning • regnskapsrådgivning •
> generasjonsskifte • selskapsstiftelse og omdanning • verdivurdering •
> opplegg av bedriftens interne organisasjon • undervisning •"
> 
> I'm getting java.lang.IllegalArgumentException: No glyph for U+2028 in
> font Lato-MediumItalic.

U+2028 is a line separator, which isn't supported by showText().

> Wouldn't it be more appropriate to assume missing glyphs have zero
> width? Is there a way to prevent this from happening?

Missing glyphs are going to appear in a PDF as an outlined rectangle, which is almost certainly
not what you want. We throw an error rather than generating a bad PDF.

You need to handle the line breaking yourself and/or use a font which provides a glyph for
U+2028.

-- John

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

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


Mime
View raw message