pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Torgeir Veimo <torgeir.ve...@gmail.com>
Subject Re: PDFont.getStringWidth() throws IllegalArgumentException
Date Fri, 19 Jun 2015 09:36:06 GMT
Ok, I guess I need to prefilter the strings. However I can't seem to
find any reference to what characters are invalid in all pdf fonts.

Is there a way to query for what glyphs are included in the font?

On 19 June 2015 at 15:07, John Hewson <john@jahewson.com> wrote:
>> 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
>



-- 
-Tor

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


Mime
View raw message