AW: [reportlab-users] TTFont with german characters
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 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 ?



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

In article <>, Jo- writes
>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

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

        from reportlab.lib import fonts
                        ('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