pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tilman Hausherr <THaush...@t-online.de>
Subject Re: Strategy for dealing with non-latin characters in base font
Date Mon, 12 Mar 2018 21:46:49 GMT
Am 12.03.2018 um 14:27 schrieb Christopher Schultz:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA256
>
> Tilman,
>
> On 3/10/18 6:26 AM, Tilman Hausherr wrote:
>> Am 09.03.2018 um 21:57 schrieb Tilman Hausherr:
>>> You can subset fonts by using PDType0Font.load(), this limits
>>> memory usage.
>> I meant "file size".
>>
>> Also important: try to use each font only once per file. You can
>> reuse fonts and images within a file. See also
>>
>> https://stackoverflow.com/questions/48377121/pdfbox-generates-pdf-a-fi
> le-of-very-large-size
>
> Okay,
> we don't have any calls to any font's load() method... we are
> simply using PDType1Font.CONSTANTS for our various fonts (HELVETICA_*
> and TIMES_*). Will that give roughly the same behavior? We don't seem
> to be having any problems with file size (yet).

With Times/Helvetica/Courier you can use only the characters from 
WinAnsiEncoding, see Appendix D in the PDF specification. This is not much.

>
> I'm not even really sure what our options are for fonts; our usage of
> PDFBox is quite simplistic. Let's say I want to be able to render a
> character such as ® or ≤ in a PDF. How do I go about discovering which
> (available) font contains the proper mapping, and then ensure that
> font's glyphs are included in the PDF?

Call PDFont.encode and catch the IllegalArgumentException.

® or ≤ might be in Symbol or Zapf Dingbats. These are also part of the standard 14 fonts
that you can use easily.



> Is it better to pick a font for
> the whole document that includes that glyph, or is it better to change
> the font for a single character, just to get the right display?

This depends on whether the font for the special characters looks 
similar to the standard 14 fonts (Times, Helvetica, Courier). If yes 
then use the extra font only for the special characters. If no, then use 
the special font for all characters.

Tilman

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


Mime
View raw message