[reportlab-users] Using <b></b> with TTFont

Tim Roberts timr at probo.com
Fri Feb 9 13:11:27 EST 2007


Juha Tuomala wrote:

>

> On Monday 05 February 2007 20:11, Tim Roberts wrote:

>

>> Remember that, in TrueType, a bold font is a completely different font

>> file from the roman version. You have to register the bold version, and

>> then tell Platypus how to find it. Something like this should work, I

>> think:

>>

>> from reportlab.lib import fonts

>> pdfmetrics.registerFont( TTFont( 'ArialBold', 'arialbd.ttf' ) )

>> fonts.addMapping( 'arial', 1, 0, 'ArialBold' )

>>

>

> So, after using the bold tags with font label 'arial', it

> should work automatically?

>


Yes.


> And addMapping syntax would be:

>

> addMapping(<target label>, <bold, boolean>, ?, <source label>)

>

> or did I miss something?

>


"Use the source, Luke!" The first parameter is the shortcut name for
the roman face, second is bold or not, third is italic or not, fourth is
the the registered name (using TTFont) of the specific font file for
this variant. There are examples in lib\fonts.py.

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



More information about the reportlab-users mailing list