Discussion:
[reportlab-users] Using Arial Unicode MS TrueType Font for Bold and Italic
Christian Wilhelm
2010-02-04 08:24:28 UTC
Permalink
Hi list,

is there any way to use the Arial Unicode MS TrueType Font for bold
and italic with reportlab? Seems like that font doesn't have any bold
or italic settings in it, but if I export a PDF-File from OpenOffice
with bold and italic characters (with Arial Unicode MS as font),
the text is rendered correctly (with the right font settings) within
kpdf.
Is there any way to get the same result with reportlab?

Thanks,
Christian
Robin Becker
2010-02-04 10:03:27 UTC
Permalink
Post by Christian Wilhelm
Hi list,
is there any way to use the Arial Unicode MS TrueType Font for bold
and italic with reportlab? Seems like that font doesn't have any bold
or italic settings in it, but if I export a PDF-File from OpenOffice
with bold and italic characters (with Arial Unicode MS as font),
the text is rendered correctly (with the right font settings) within
kpdf.
Is there any way to get the same result with reportlab?
Thanks,
Christian
...........
I don't think we have at present assuming no bold version of MS Unicode exists
etc etc.

Currently we use the technique of using the -Bold -Italic or -BoldItalic
versions of fonts to get the various font styles, but the old fashioned way to
do this is not done in reportlab. In the old nroff/troff world it was common to
do a small horizontal shift and overprint to get bold and adjust the slant to
get italic. Clever renderers sometimes create these fonts on the fly using
various algorithms. I wonder if there are some utilities that could create the
bolded/italicised versions of the fonts.
--
Robin Becker
Robin Becker
2010-02-04 13:17:36 UTC
Permalink
Post by Christian Wilhelm
Hi list,
is there any way to use the Arial Unicode MS TrueType Font for bold
and italic with reportlab? Seems like that font doesn't have any bold
or italic settings in it, but if I export a PDF-File from OpenOffice
with bold and italic characters (with Arial Unicode MS as font),
the text is rendered correctly (with the right font settings) within
kpdf.
Is there any way to get the same result with reportlab?
Thanks,
Christian
.......

I just played a bit with Canvas.setTextRenderMode and it is possible to make
fonts bolder without too much trouble, but the technique relies on using
stroking and filling and that makes the appearance of the bolded font depend on
line width, join etc etc. The results show that the text render mode is
remembered and is subject to the standard stroking properties. You get funny
results with line width 2 and join 0 etc etc.


from reportlab.pdfgen import canvas
canv = canvas.Canvas('t.pdf')

canv.setLineWidth(1)
canv.setLineJoin(1)
canv.drawString(72,8*72,'ABCDEF abcdef mode=None')
canv.drawString(72,8*72-1*12,'ABCDEF abcdef mode=1',mode=1)
canv.drawString(72,8*72-2*12,'ABCDEF abcdef mode=None')
canv.drawString(72,8*72-3*12,'ABCDEF abcdef mode=2',2)
canv.drawString(72,8*72-4*12,'ABCDEF abcdef mode=None')

canv.save()
--
Robin Becker
Nate Silva
2010-02-04 15:06:13 UTC
Permalink
Post by Christian Wilhelm
is there any way to use the Arial Unicode MS TrueType Font for bold
and italic with reportlab? Seems like that font doesn't have any bold
or italic settings in it, but if I export a PDF-File from OpenOffice
with bold and italic characters (with Arial Unicode MS as font),
the text is rendered correctly (with the right font settings) within
kpdf.
Is there any way to get the same result with reportlab?
If you need a font with a wide range of Unicode characters, try Free Sans (http://www.gnu.org/software/freefont/). That web page lists the writing systems it supports.

Although not identical to Arial, it is very similar (it?s Helvetica) and is supposed to have identical metrics, making it a drop-in replacement. It comes with bold, italic and bold-italic flavors.

(If you do not actually need the Unicode characters you could of course sub regular Arial.)

Regards,
N.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 3672 bytes
Desc: not available
Url : <http://two.pairlist.net/pipermail/reportlab-users/attachments/20100204/4abec3db/attachment.bin>
Continue reading on narkive:
Search results for '[reportlab-users] Using Arial Unicode MS TrueType Font for Bold and Italic' (Questions and Answers)
4
replies
Laptop font help!!!!!!!?
started 2009-06-20 20:40:36 UTC
laptops & notebooks
3
replies
IPA Fonts for mac?
started 2007-01-29 20:04:29 UTC
software
Loading...