[reportlab-users] TTF Problem

Tim Roberts timr at probo.com
Tue Feb 28 13:09:24 EST 2006


On Mon, 27 Feb 2006 20:52:29 +0000, Andy Robinson <andy at reportlab.com>
wrote:

>It's good this came up as I had not thought of it.  Symbol and 
>ZapfDingbats are standard 'builtin' fonts and logically one should be 
>using the correct Unicode code points - or at least support them.
>
>If we move to a purist Unicode approach in version 2.0, I wonder if we 
>will need some explicit sugar to make this taste less painful?
>
>One possibility is that we could add some flags and offsets when someone 
>registers a font, so that you can just pass in
>   registerFont(TTFont("my_symbols.ttf", offset=0xF000)
>and then continue to use the bytes you used to use.
>  
>

TTFont can determine this on its own, by reading the tables in the font
file.  The cmap table has a "platform ID" and an "encoding ID" that tell
how the glyphs are actually mapped.  A normal text font is "3.1"
(platform 3, encoding 1), which means UCS-16.  A symbol font is "3.0",
which means "add 0xF000".

Those are the only two encodings "blessed" by Microsoft.  Apple fonts
sometimes have a platform ID of 0, which is also UCS-16.

-- 
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.



More information about the reportlab-users mailing list