[reportlab-users] TrueType Fonts

Jarek Zgoda reportlab-users@reportlab.com
Thu, 13 Mar 2003 19:28:22 +0100


Dnia Thu, Mar 13, 2003 at 05:27:37PM +0100, Marek Pêtlicki pisze:

>from reportlab.lib.fonts import addMapping
>from reportlab.pdfbase import pdfmetrics
>
># Adding TT font Arial + mappings
>pdfmetrics.registerFont(TTFont('Arial', 'arial.ttf'))
>pdfmetrics.registerFont(TTFont('Arial-Bold', 'arialbd.ttf'))
>pdfmetrics.registerFont(TTFont('Arial-Italic', 'ariali.ttf'))
>pdfmetrics.registerFont(TTFont('Arial-BoldItalic', 'arialbi.ttf'))
>addMapping('Arial', 0, 0, 'Arial')
>addMapping('Arial', 1, 0, 'Arial-Bold')
>addMapping('Arial', 0, 1, 'Arial-Italic')
>addMapping('Arial', 1, 1, 'Arial-BoldItalic')

Is there any reason, that you cann't register the font with some 
other name? I usually register 3 fonts for all documents (sans-serif,
serif and monospace) under usual names Helvetica, Times and Courier - 
the real fonts have nothing in common with these except names. On Windows
they are Arial, Times New Roman and Courier New, on other systems they
represent usually other fonts.

-- 
Jarek Zgoda
http://www.zgoda.biz/                        JID:zgoda@jabber.atman.pl