[reportlab-users] Using non-standard fonts on Mac OS X
Tim Jarman
reportlab-users@reportlab.com
Wed, 26 May 2004 15:23:24 +0100
On Wednesday 26 May 2004 13:30, Dinu Gherman wrote:
> Hi Tim,
>
> I get the same error, but there is no such TTF file on my system:
>
> [localhost:~] dinu% ll /Library/Fonts/
> total 24152
> -rw-rw-r-- 1 root admin 0 Feb 27 08:02 Arial Black
> -rw-rw-r-- 1 root admin 0 Feb 27 08:02 Arial Narrow
> -rw-rw-r-- 1 root admin 0 Feb 27 08:02 Arial Rounded Bold
>
> For true TTF you must have a .ttf file. On OS X Apple uses some
> font magic thingy which mixes/hides fonts under a .dfont format
> which cannot be used right away from ReportLab. You can convert
> such files using fondu.sourceforge.net...
>
Aha! fondu was the missing link! Thank you Mr Williams!
I copied the original Arial font file (using the cmd-R thing from FontBook to
tell me its whereabouts) and ran fondu on my copy which got me a bunch
of .ttf files (Arial, ArialBold, ArialItalic and ArialBoldItalic). When I
pointed my test script at the new Arial.ttf it successfully created a TTFont
object -- but alas, it wouldn't register. I got a ValueError in addMapping
(fonts.py) suggesting it already *has* Arial registered. So I commented out
the registration step and what do you know -- my test PDF file is created!
I'm confused now... is font registration a one-off thing, i.e. something my
installation procedure should do? I thought I was going to have to do the
font magic as part of application startup but apparently not.
> But... I really can't find any real file for Arial on my system,
> although I can set Arial in text editors... Wait, I can see some
> files named ArialHB.ttf and ArialHBBold.ttf, which I tried to use
> with RL earlier, but with no luck telling from the folder named
> "erroneous" containing them... And I really don't remember where
> I got or converted them from...
>
Can you see Arial in FontBook? If so the cmd-R thing will reveal where the
font file is. If not, then you don't have it, which surprises me because I
thought it was a standard font on Macs. (I'm sure it always used to be pre-OS
X anyway.) Maybe installing M$ Office caused Arial to be installed on my
system?
Another thought: have you maybe got it in OS 9 as opposed to OS X?
> Please let me know if you solve this...
>
I've sort of solved it, I guess, but I wish I knew what was going on!
Any prospect of dfont support in future releases of ReportLab, BTW? To my
non-legal eye the licensing of fondu appears benign.
Tim J