[reportlab-users] single font for document

Tim Roberts timr at probo.com
Mon Feb 12 14:15:26 EST 2007


Something Special wrote:

> Hello,

> how to globally(for current pdf only) set reportlab to use my font?

>

> I mean, to allow encodings:

>

> from reportlab.pdfbase import pdfmetrics

> from reportlab.pdfbase.ttfonts import TTFont

> from reportlab.lib.fonts import addMapping

>

> pdfmetrics.registerFont(TTFont('Times', 'Times.ttf'))

> pdfmetrics.registerFont(TTFont('TimesI', 'TimesI.TTF'))

> pdfmetrics.registerFont(TTFont('TimesB', 'TimesBD.TTF'))

> pdfmetrics.registerFont(TTFont('TimesBI', 'TimesBI.TTF'))

>

> addMapping('Times', 0, 0, 'Times')

> addMapping('Times', 0, 1, 'TimesI')

> addMapping('Times', 1, 0, 'TimesB')

> addMapping('Times', 1, 1, 'TimesBI')

>

> But this seems to work for Paragraphs only - inside a table it shows

> black squares.

>


Can you post a runnable example?

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



More information about the reportlab-users mailing list