364,111 Members | 2056 Browsing Online
Community for Developers & IT Professionals
Bytes IT Community

Searching for UTF8 capable font for REPORTLAB

Andreas Jung
P: n/a
Andreas Jung
Reportlab has some problems with creating PDFs from UTF8 encoded text. For
this reason
they are using a truetype font rina.ttf which looks *very ugly*. Does
anyone know of a
suitable free available truetype font that works with UTF8?

-aj


Jul 18 '05 #1
Share this Question
Share on Google+
3 Replies


JanC
P: n/a
JanC
Andreas Jung <lists@andreas-jung.com> schreef:
[color=blue]
> Reportlab has some problems with creating PDFs from UTF8 encoded text.
> For this reason they are using a truetype font rina.ttf which looks
> *very ugly*. Does anyone know of a suitable free available truetype
> font that works with UTF8?[/color]

AFAIK a "UTF8 capable TrueType font" doesn't exist; but most modern
TrueType fonts have Unicode character tables?

(From the screenshots in the userguide.pdf Rina doesn't look ugly IMHO, but
it's clearly not intended for large pieces of body text. :-)

--
JanC

"Be strict when sending and tolerant when receiving."
RFC 1958 - Architectural Principles of the Internet - section 3.9
Jul 18 '05 #2

Marijan Tadin
P: n/a
Marijan Tadin
Try following code, replace value of my_location_of_TTF with your
location of TTF (of course you should have TT fonts somewhere on your
machine, on windows they are allways there, AFAIK you can download them
for linux):

There is also mailing list on ReportLabs website, it is where I found
the hint how to use ReportLab and Unicode.


from reportlab.pdfgen import canvas
from reportlab.pdfbase import pdfmetrics
from reportlab.pdfbase.ttfonts import TTFont

canv = canvas.Canvas('test_03.pdf')
fontname = 'CS'

my_location_of_TTF = 'C:\WINNT\FONTS\comic.TTF'

pdfmetrics.registerFont(TTFont(fontname,my_locatio n_of_TTF))
a=u'\u010d\u0107\u017e\u0161\u0111\u010c\u0106\u01 7d\u0160\u0110'
canv.setFont(fontname,10)
canv.drawString(50,100,'Some text:'+a.encode('UTF8'))
canv.save()


"Andreas Jung" <lists@andreas-jung.com> wrote in message
news:mailman.429.1074256100.12720.python-list@python.org...[color=blue]
> Reportlab has some problems with creating PDFs from UTF8 encoded text.[/color]
For[color=blue]
> this reason
> they are using a truetype font rina.ttf which looks *very ugly*. Does
> anyone know of a
> suitable free available truetype font that works with UTF8?
>
> -aj
>
>[/color]

Jul 18 '05 #3

Marijan Tadin
P: n/a
Marijan Tadin
Try following code, replace value of my_location_of_TTF with your
location of TTF (of course you should have TT fonts somewhere on your
machine, on windows they are allways there, AFAIK you can download them
for linux):

There is also mailing list on ReportLabs website, it is where I found
the hint how to use ReportLab and Unicode.


from reportlab.pdfgen import canvas
from reportlab.pdfbase import pdfmetrics
from reportlab.pdfbase.ttfonts import TTFont

canv = canvas.Canvas('test_03.pdf')
fontname = 'CS'

my_location_of_TTF = 'C:\WINNT\FONTS\comic.TTF'

pdfmetrics.registerFont(TTFont(fontname,my_locatio n_of_TTF))
a=u'\u010d\u0107\u017e\u0161\u0111\u010c\u0106\u01 7d\u0160\u0110'
canv.setFont(fontname,10)
canv.drawString(50,100,'Some text:'+a.encode('UTF8'))
canv.save()


"Andreas Jung" <lists@andreas-jung.com> wrote in message
news:mailman.429.1074256100.12720.python-list@python.org...[color=blue]
> Reportlab has some problems with creating PDFs from UTF8 encoded text.[/color]
For[color=blue]
> this reason
> they are using a truetype font rina.ttf which looks *very ugly*. Does
> anyone know of a
> suitable free available truetype font that works with UTF8?
>
> -aj
>
>[/color]

Jul 18 '05 #4

Post your reply

Help answer this question



Didn't find the answer to your Python question?

You can also browse similar questions: Python