AW: [reportlab-users] TTFont with german characters

reportlab-users@reportlab.com reportlab-users@reportlab.com
Wed, 16 Oct 2002 17:15:16 +0200


Hello Robin,

thanks for your answere,
now Arial Narrow works fine , but my DaxLight font will not.
Other prob is how to display german chars from a True Type font.

I get
tables.py line 671 , in _DrawCell
UnicodeError :ASCII encoding error: ordinal not in range 128

in rl_config defaultEncoding is set to
defaultEncoding =           'WinAnsiEncoding'

can you help with this ?

regards

Jo

-----Ursprüngliche Nachricht-----
Von: reportlab-users-admin@reportlab.com
[mailto:reportlab-users-admin@reportlab.com]Im Auftrag von Robin Becker
Gesendet: Mittwoch, 16. Oktober 2002 16:12
An: reportlab-users@reportlab.com
Betreff: Re: [reportlab-users] TTFont in ParagraphStyle


In article <FDEJJKLBELAKNCMDIADEEEOBCCAA.Jo-Bader@gmx.de>, Jo-
Bader@gmx.de writes
>
>Hello,
>
>i try to get a custom TT-Font into a ParagraphStyle
>which is for formating a paragraph in a Table
>
>
>       pdfmetrics.registerFont(TTFont('Arial', 'Arialn.ttf')) # works fine
>
>       levelZeroParaStyle = \
>           ParagraphStyle(name='LevelZero',
>                          fontName='Arial',
>                          fontSize=10,
>                          leading=11,
>                          firstLineIndent = -epsilon,
>                          leftIndent = 0*delta + epsilon)
>
>       ...
......
I think there's a bug in what's currently being done for registration.
The problem is that when we use bold/italic etc we need to have the
concept of a root face name. That allows us to map

 -   -       b    -      -     i      b     i
Times-Roman Times-Bold Times-Italic Times-BoldItalic

I'm fairly sure that registerFont isn't doing the right thing about
this.

Assuming that Arial is the base font you need to do something like

        from reportlab.lib import fonts
        fonts._tt2ps_map.update({
                        ('arial', 0, 0) :'Arial',
                        ('arial', 1, 0) :'Arial',
                        ('arial', 0, 1) :'Arial',
                        ('arial', 1, 1) :'Arial',
                        })
        fonts._ps2tt_map.update({'arial': ('arial',0,0)})


of course to do it correctly you need to register the correct fonts and
use their names rather than just Arial.
--
Robin Becker
_______________________________________________
reportlab-users mailing list
reportlab-users@reportlab.com
http://two.pairlist.net/mailman/listinfo/reportlab-users