problems in the font drawing code?

Peter Damoc pdamoc at gmail.com
Sat Oct 6 01:47:04 PDT 2007


Hi list,

I have some problems with the font drawing subsystem.

first I couldn't draw text using wx.GCDC.DrawText because it wouldn't render
the custom fonts that I was using...

I load the fonts like this:

from ctypes import *
import os
import os.path
gdi32=3D WinDLL("gdi32.dll")
fonts =3D [font for font in os.listdir("fonts") if font.endswith("otf") or
font.endswith("ttf") ]
for font in fonts:
    gdi32.AddFontResourceA(os.path.join(fontdir,font))

The font is "Fontin"
http://www.josbuivenga.demon.nl/fontin.html

so instead of using the wx.GCDC.DrawText I used the the
MemoryDC.DrawTextwhich rendered the font ok. (the mdc is the one used
to create the gcdc)

All seamed to work good enough until I stumbled upon a crazy bug:

The font rendering shows an offset about the size of the frame's title-bar,
the font being drawn higher than it should have been.

When I show the first time the Frame everything is Ok... but upon some
clicking... all the font rendering in the frame moves up and stays up.
Every other drawing (bitmaps, paths) remains where it should be.

And now for the fun part... I only see this bug on a Windows MCE laptop.
My main development machine, another laptop (XP SP2) and a Parallels virtual
machine ALL show the rendered image right.

I'm completely in the dark here....

ANY idea is welcomed!

Thank you.
Peter.
-- =

There is NO FATE, we are the creators.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.wxwidgets.org/pipermail/wxpython-dev/attachments/20071006=
/ffc7f1b4/attachment.htm


More information about the wxpython-dev mailing list