[reportlab-users] Font Helvetica always used?

Glenn Linderman v+python at g.nevcal.com
Thu Jun 18 18:50:15 EDT 2015

On 6/18/2015 12:59 PM, Robin Becker wrote:

Thanks for all the deleted stuff. Clear now.

>> Except, in looking at Canvas, it doesn't seem to have a fontname parameter,
>> >nor a catchall keyword parameter.  So I don't understand your comment "It
>> >can be passed in"... is that just a possibility in a parallel universe?
> It can't be passed in directly, but can be via the default in
> rl_config. Alternatively before a canvas is used you can call setFont
> and that font will be the one used. However, unless it is one of the
> standard 14 you still need to register a font before use.

So you are saying that if you call

from reportlab.pdfbase.ttfonts import TTFont
from reportlab.pdfbase.pdfmetrics import registerFont, registerFontFamily
canv = reportlab.pdfgen.canvas.Canvas( sys.stdout )
canv.setFont('arial', 10 )

before doing any other Canvas operations, that 'Helvetica' will not 
appear in the output file?

That seems simpler than doing all the configuration stuff ahead of 
time... because the registration of fonts is often coded around the same 
time as the Canvas is initialized in setup code.

I suppose the reason you described the configuration tricks first, is 
that once created they minimize the code changes in all the applications 
using that configuration.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pairlist2.pair.net/pipermail/reportlab-users/attachments/20150618/03e9e4c1/attachment.html>

More information about the reportlab-users mailing list