[reportlab-users] RenderPM and TTF fonts
Robin Becker
robin at reportlab.com
Wed Oct 10 04:53:36 EDT 2007
Nizam Sayeed wrote:
> I saw an example in the code and did this:
>
> pdfmetrics.registerFont( ttfonts.TTFont( "Vera", "Vera.ttf" ) )
>
> But I am getting this error:
>
> Can't setFont(Vera) missing the T1 files? Originally
> exceptions.AttributeError: TTEncoding instance has no attribute 'vector'
>
> I guess it does not handle TTF fonts. So what is the solution when trying to
> display unicode text using RenderPM? I had converted my TTF font to Type 1
> using ttf2pt1 but it does not seem to preserve the unicode glyphs. I was
> getting this error when trying to use the converted font:
>
> 'utf8' codec can't decode bytes in position 10-12: invalid data
>
> What can I do? Any help would be greatly appreciated.
>
.......
the renderPM extension does support true type fonts. I suspect something is
wrong with your installation if there's no Vera font in the reportlab/fonts folder
this script runs fine on my machine
from reportlab.pdfbase import ttfonts, pdfmetrics
f=ttfonts.TTFont('Vera','Vera.ttf')
pdfmetrics.registerFont(f)
My reportlab/fonts folder contains the following related files
Vera.ttf
VeraBI.ttf
VeraBd.ttf
VeraIt.ttf
bitstream-vera-license.txt
>>
>> I have a quick question. Does RenderPM support TTF fonts? And if so, how
>> do I do this? I wanted to use a unicode font because I will need to create
>> charts that will display French text. Thanks.
>>
>> Best regards,
>>
>> -- Nizam Sayeed
.......
--
Robin Becker
More information about the reportlab-users
mailing list