On Fri, Apr 26, 2013 at 11:42 PM, Mariano Reingart <[email protected]> wrote:
> On Fri, Apr 26, 2013 at 6:34 PM, Jonathan Lundell <[email protected]> wrote:
>> On 26 Apr 2013, at 1:17 PM, Jurgis Pralgauskis
>> <[email protected]> wrote:
>>
>> ok, SOLVED ttf issue for  unicode example
>> http://code.google.com/p/pyfpdf/wiki/Unicode
>> just needed to create directory    gluon > contrib > fpdf > font
>> and place needed ttf files insited it :)
>> then pdf.write(8, u"Ąžuolas")  works fine
>>
>>
>> The fpdf logic uses utf8 for fonts it sees as UTF-based, otherwise latin-1.
>> It looks to me as though either it isn't recognizing your fonts as UTF, or
>> there's some overlooked case that it's making a mistake with. Have a look at
>> FPDF.set_font:
>>
>>         self.unifontsubset = (self.fonts[fontkey]['type'] == 'TTF')
>>
>> ...and make sure it's getting set.
>>
>
> Yes, as Jhonatan saids, FPDF (and the PDF standard, BTW) only support
> latin1 characters for standard font.
>
> If you need utf8 characters, you need to embeed a T

You need to embed a UTF8 TTF font, for example:

# Add a DejaVu Unicode font (uses UTF-8)
# Supports more than 200 languages. For a coverage status see:
# 
http://dejavu.svn.sourceforge.net/viewvc/dejavu/trunk/dejavu-fonts/langcover.txt
pdf.add_font('DejaVu', '', 'DejaVuSansCondensed.ttf', uni=True)

(sorry, the previous message was sent incomplete)

I'll try to enhance the docs about this, thank for reporting the issue

Best regards

Mariano Reingart
http://www.sistemasagiles.com.ar
http://reingart.blogspot.com

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to