[reportlab-users] "setfont" tag in RML seems not to work propelry
Robin Becker
reportlab-users@reportlab.com
Tue, 20 Jul 2004 09:37:51 +0100
Ulrich Weber wrote:
>
>
> When using the setfont tag in RML with a font name different from
> "Helvetica" or "Times-Roman" I get a python exception as shown in the
> following example:
>
> RML-Code:
>
> <?xml version="1.0" encoding="iso-8859-1" standalone="no" ?>
> <!DOCTYPE document SYSTEM "rml_1_0.dtd">
> <document filename="dummy.pdf">
> <template pageSize="(21cm, 29.7cm)" leftMargin="2cm" rightMargin="2cm"
> topMargin="2.5cm" bottomMargin="2.5cm">
> <pageTemplate id="main">
> <pageGraphics>
> <setFont name="Helvetica-Bold" size="14"/>
> <drawString x="2cm" y="28.0cm">test</drawString>
> </pageGraphics>
> <frame id="body" x1="1.8cm" y1="2.5cm" width="17.4cm" height="24.7cm"/>
> </pageTemplate>
> </template>
> <stylesheet>
> </stylesheet>
> <story>
> <para>This is the "story". This is the part of the RML document where
> your text is placed.</para>
> </story>
> </document>
>
> Resulting python message:
>
> Traceback (most recent call last):
........
> I am using Python 2.3; may this cause the problem ?
>
> I am looking forward to your advice!
>
> Ulrich Weber
Ulrich I tried this exact source with the current SVN version of
rml2pdf/reportlab and it works perfectly (as expected) with Python 2.3 under
win32 and freebsd. Since Helvetica-Bold is one of the standard fonts it should
be available always.
Is it possible that your source text is encoded in some way? I can't seem to
find character 0x93 in your example probably. When I use that character
explicitly pasted in (it seems to be a special double quote) I still get a
working PDF.
Can you say which version or rml2pdf/reportlab you are using?
--
Robin Becker