reportlab python add font style

Solutions on MaxInterview for reportlab python add font style by the best coders in the world

showing results for - "reportlab python add font style"
Ben
21 Oct 2016
1from reportlab.pdfbase import pdfmetrics
2from reportlab.pdfbase.ttfonts import TTFont
3
4pdfmetrics.registerFont(TTFont('Vera', 'Vera.ttf'))
5pdfmetrics.registerFont(TTFont('VeraBd', 'VeraBd.ttf'))
6pdfmetrics.registerFont(TTFont('VeraIt', 'VeraIt.ttf'))
7pdfmetrics.registerFont(TTFont('VeraBI', 'VeraBI.ttf'))
8
9canvas.setFont('Vera', 32)
10canvas.drawString(10, 150, "Some text encoded in UTF-8")
11canvas.drawString(10, 100, "In the Vera TT Font!")