[reportlab-users] How to get a list of available fonts?

reportlab-users@reportlab.com reportlab-users@reportlab.com
Wed, 10 Sep 2003 09:36:06 -0400 (EDT)


I found out, but this seems to work, just in case anyone else cares:


from reportlab.pdfgen import canvas
cc = canvas.Canvas('FontChoices.pdf')
from reportlab.lib.units import inch
text = "The quick brown fox jumped over the lazy dog."
x = 1.8*inch
y = 2.7*inch
for font in cc.getAvailableFonts():
    cc.setFont(font, 10)
    cc.drawString(x, y, text)
    cc.setFont("Helvetica", 10)
    cc.drawRightString(x-10, y, font+":")
    y = y - 13
cc.showPage()
cc.save()

#strictly gravy.
import os
os.system('start FontChoices.pdf')


That's it.





> Hi-
>
> I tried 'Arial' and got a key error.  How do I get a list of available
> fonts?
>
> Thanks.
> _______________________________________________
> reportlab-users mailing list
> reportlab-users@reportlab.com
> http://two.pairlist.net/mailman/listinfo/reportlab-users
>