[reportlab-users] single font for document

Robin Becker robin at reportlab.com
Mon Feb 12 15:00:12 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.

.....

The table elements use the canvas font so you need to set that up in a Table
style or on the canvas.
--
Robin Becker


More information about the reportlab-users mailing list