pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marc Kaufman <m...@eeph.com>
Subject Re: Choosing a font for non-ASCII characters
Date Sun, 03 Mar 2019 16:16:51 GMT
If you look at a Type 1 font with CharacterMap, you will see that it has 
many more than 255 characters. These characters can be accessed by using 
a Differences entry in the Font Dictionary to remap one of the 255 to 
the desired character. Characters like 'lessequal' can be reached in 
this way. See the PDF Reference, section 9.

Chinese (Asian fonts in general) requires Type 0 fonts.

Marc

On 1/30/2019 5:56 PM, Christopher Schultz wrote:
> Hello,
>
> We are using PDFBox to generate PDFs in a very simple way and only
> including fonts available from the PDType1Font class (e.g.
> PDType1Font.HELVETICA). The PDFs we are generating are really only
> including a few title/subtitles, text, and bulleted/numbered lists.
>
> Everything is fine when we use what is probably in the standard Latin
> alphabet, and we've had some troubles with special characters that
> don't fit in there such as ≥ and ≤. We've dealt with that by simply
> replacing "≤" with "<=" and so on, but we're starting to use languages
> that don't use Latin script and so we can no longer replace out way
> out of the problem.
>
> For example, I need to be able to put Chinese characters into a PDF we
> generate. So let's take the text "中國" which is just the word "China"
> in Traditional Chinese script.
>
> First, how can I find out that the character isn't going to fit into
> the font that I'm currently using? Should I do it for every character
> we try to put into the page, or should we just catch exceptions when
> we try to write the text to the page and then scan at that point? I'm
> trying to avoid writing hideously inefficient code to handle these
> situations.

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


Mime
View raw message