[reportlab-users] Embedded font problems

jsmith4332 at yahoo.com jsmith4332 at yahoo.com
Mon Mar 13 12:25:05 EDT 2017

It does not. (Running this in a docker container if that matters) 

    On Monday, March 13, 2017 12:14 PM, Tim Roberts <timr at probo.com> wrote:

  jsmith4332--- via reportlab-users wrote:
  Does anyone have troubleshooting tips for figuring out why an embedded TTF font does not work in reportlab (just shows rectangles)? I'm trying to use https://grandzebu.net/informatique/codbar/code128.ttf (yes, I would like to use a barcode font instead of the built in barcode generator due to quality issues when printing on a low DPI printer)  
 Odd.  I just tried this, and it worked perfectly:
from reportlab.pdfgen import canvas
 from reportlab.lib.pagesizes import LETTER
 from reportlab.pdfbase import pdfmetrics
 from reportlab.pdfbase.ttfonts import TTFont
 pdfmetrics.registerFont( TTFont( 'code128', '/tmp/code128.ttf'))
 canv = canvas.Canvas( 'code.pdf', pagesize=LETTER )
 canv.setPageCompression( 0 )
 canv.setFont( 'code128', 14 )
 canv.drawString( 100, 100, "0123456789" )
 Does it work for you?
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.
reportlab-users mailing list
reportlab-users at lists2.reportlab.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pairlist2.pair.net/pipermail/reportlab-users/attachments/20170313/ddc0c264/attachment-0001.html>

More information about the reportlab-users mailing list