[reportlab-users] Adobe Reader - Outline Font.

Robin Becker robin at reportlab.com
Tue Apr 3 14:04:47 EDT 2007


Ian Sparks wrote:

> Hello,

>

>

>

> If I use addOutlineEntry() is there any way to se the font that Adobe

> Reader will use to display the outline?

>

>

>

> I'm setting outline text using some Chinese (trad) characters and it

> looks like it's using only the Latin encoding in Adobe Reader.

>

>

>

> I'm experimenting with the Code2000 font. Can I set the reader to use

> that font for the outline if I embed it?

>

>

>

> FYI : This is Reportlab 2.0

>

........

We recently had to go through this ourselves. With latest reportlab we can use
unicode encoding in that part of the pdf output and then PDF will respect the
glyphs if the appropriate fonts are available to the reader. The fonts used are
not a property of the document (I think), but of the viewing application. That's
true for bookmarks at least. I believe the same is true for some of the
annotations eg author etc etc.

The problem is that I cannot figure out exactly how this gets done in
platypus/canvas land as the examples are all in rml eg

outlineAdd level="1">Ampersand (&) and Japanese
(またはご希望のホテルを1つ選択してください) Test</outlineAdd>
<para>Check that the ampersand (&amp;) appears correctly in the outline/bookmark
list.</para>

the above text in the example is good utf8 and when I view it I see japanese
characters in the bookmarks.

I think it works like this:

1) the outline texts eventually end up using PDFString instances.
2) The PDFString instance checks to see if the text can be rendered using PDFDoc
encoding. If yes that is used otherwise utf_16_be is output and then it's the
viewer's responsibility to make the right glyph substitutions.
--
Robin Becker


More information about the reportlab-users mailing list