[reportlab-users] Using bold and italic with a generic TTF

Tim Roberts timr at probo.com
Mon Mar 12 14:40:51 EDT 2007


Lorenzo Mancini wrote:

>

>> It would be interesting to look at the PostScript, to see what

>> OpenOffice generates.

>>

>

> I'm attaching the OpenOffice generated PDF file, containing the same

> Korean and Turkish text you found in my little script. I applied italic,

> bold and bold-italic styles.

>

> I'm seeing the result with Acrobat Reader 6.0 under Windows and xpdf

> under Linux.

>

> (with xpdf, the output is a little weird, e.g. the bold "ı" in "sınav"

> gets a little white centered vertical line).

>


You made this a bit of a challenge to analyze, because you didn't reuse
very many letters!

Fortunately, there was one, and it is very interesting. Note that the
letter "y" occurs both in the roman and the in the bold italic
sections. When the text is drawn, they are using the same glyph code in
both places. So, they're using the roman font all through this. To
draw the italic text, they set a transform matrix for text to draw it
skewed (using Tm), and then place each character individually. To draw
bold text, they change the rendering mode to stroke/fill and alter the
line width.

Now, glossing over the fact that the text rendering code in ReportLab is
already complicated, this shouldn't be too hard to add. A suitably
motivated individual with a week to spare should be able to do it.

--
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.



More information about the reportlab-users mailing list