[reportlab-users] Problem with using TTFont in chart
Robin Becker
robin at reportlab.com
Tue Sep 19 06:34:17 EDT 2006
Yura Asyutin wrote:
> Robin, hi!
>
> I tried to use TTFont, while rendering text in graphic charts and run into
> the same problem, described here:
>
> http://article.gmane.org/gmane.comp.python.reportlab.user/4853
>
> Need to use TTFont is to internationalize chart labels, to use UTF-8.
>
>
>
> Also I found your answer about this:
> http://two.pairlist.net/pipermail/reportlab-users/2003-November/002402.html
>
> As I understand, you successfully used TTFont by RenderPM, avoiding call to
> _renderPM.makeT1Font, that renders only Type1
> fonts.
>
> Unfortunately, I couldn't succesfully use TTFont in chart. Could you
> describe more detailed the way to do it (example would be appreciated)? Is
> it possible to use ttfont in chart?
> Is there any other way to internationalize charts ( to use UTF-8)?
>
> Thanks, Yuriy Asyutin.
>
Yuriy if you look in the reprotlab/graphics/testshapes.py file there's an
example of using ttf fonts at the bottom (getDrawing13). Basically you need to
register the font and then use it
from reportlab.pdfbase import pdfmetrics, ttfonts
pdfmetrics.registerFont(ttfonts.TTFont("LuxiSerif", "luxiserif.ttf"))
......
String(x, y, text, fontName='LuxiSerif', fontSize = fontSize)
LuxiSerif is only an example font so doesn't have many characters.
--
Robin Becker
More information about the reportlab-users
mailing list