pombreda / xhtml2pdf

Automatically exported from code.google.com/p/xhtml2pdf
GNU General Public License v2.0
0 stars 0 forks source link

UTF-8 font problem #34

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Message from list:

Hi,

I just started using Pisa and everything was going smoothly until I
faced requirement of using typeface that is UTF-8 friendly and covers
international characters.

So, following documentation I added CSS bits responsible of embedding
typeface and noticed my HTML piece is now causing errors. First, I
started investigating typefaces I decided to use as I thought they are
not loading properly. Later, during trial and error phase I discovered
when I comment out all images inside my HTML file, everything is
working fine.

I am using 3.0.29 release and here's diff which illustrates behavior
mentioned above:

Index: tags/3.0.29/tests/samples/utf8.html
===========================================================
========
--- tags/3.0.29/tests/samples/utf8.html (revision 61)
+++ tags/3.0.29/tests/samples/utf8.html (working copy)
@@ -6,6 +6,7 @@
 @import url("unicode.css") print;
 </style>
 </head><body bgcolor="#ffffff" text="#000000">
+<img src="img/tree.jpg" />
 <p>Source: <a href="http://www.columbia.edu/kermit/utf8.html">http://
www.columbia.edu/kermit/utf8.html</a></p>

Traceback:

Converting utf8.html to /Users/maciek/Downloads/xhtml2pdf/tags/3.0.29/
tests/samples/utf8.pdf...
ERROR [ho.pisa] Document error
Traceback (most recent call last):
  File "/Users/maciek/Downloads/xhtml2pdf/tags/3.0.29/sx/pisa3/
pisa_document.py", line 153, in pisaDocument
    doc.build(c.story)
  File "/Volumes/Dev/projects/tensionkru/tns-bilety/webapp/../
webapp/../lib/reportlab/platypus/doctemplate.py", line 777, in build
    self.handle_flowable(flowables)
  File "/Volumes/Dev/projects/tensionkru/tns-bilety/webapp/../
webapp/../lib/reportlab/platypus/doctemplate.py", line 665, in
handle_flowable
    if frame.add(f, canv, trySplit=self.allowSplitting):
  File "/Volumes/Dev/projects/tensionkru/tns-bilety/webapp/../
webapp/../lib/reportlab/platypus/frames.py", line 159, in _add
    w, h = flowable.wrap(aW, h)
  File "/Users/maciek/Downloads/xhtml2pdf/tags/3.0.29/sx/pisa3/
pisa_reportlab.py", line 446, in wrap
    Paragraph.wrap(self, availWidth, availHeight)
  File "/Users/maciek/Downloads/xhtml2pdf/tags/3.0.29/sx/pisa3/
reportlab_paragraph.py", line 871, in wrap
    blPara = self.breakLines([first_line_width, later_widths])
  File "/Users/maciek/Downloads/xhtml2pdf/tags/3.0.29/sx/pisa3/
reportlab_paragraph.py", line 1083, in breakLines
    spaceWidth = stringWidth(' ',fontName, fontSize)
  File "/Volumes/Dev/projects/tensionkru/tns-bilety/lib/reportlab/
pdfbase/pdfmetrics.py", line 718, in _py_stringWidth
    return getFont(fontName).stringWidth(text, fontSize,
encoding=encoding)
  File "/Volumes/Dev/projects/tensionkru/tns-bilety/lib/reportlab/
pdfbase/pdfmetrics.py", line 680, in _py_getFont
    return findFontAndRegister(fontName)
  File "/Volumes/Dev/projects/tensionkru/tns-bilety/lib/reportlab/
pdfbase/pdfmetrics.py", line 662, in findFontAndRegister
    face = getTypeFace(fontName)
  File "/Volumes/Dev/projects/tensionkru/tns-bilety/lib/reportlab/
pdfbase/pdfmetrics.py", line 621, in getTypeFace
    return _typefaces[faceName]
KeyError: 'code2000'

Many thanks for and advice on that
Maciek

Original issue reported on code.google.com by dirk.holtwick on 27 Mar 2009 at 7:03

GoogleCodeExporter commented 9 years ago

Original comment by dirk.holtwick on 27 Mar 2009 at 5:10