wx.python GCDC font type problems

Hi, I am trying to change the font weight when drawing in a bitmap in GCDC in wxpython. Everything seems to work fine and I can get the text in my image, however I cannot change some of the font settings. The size can be changed without problems, but for example the FONTWEIGHT cannot be changed and I always get the default value (NORMAL instead of LIGHT).

Please find a sample code attached.

I have tested the same piece of code using “wx.MemoryDC(bmp)” alone instead of “wx.GCDC(wx.MemoryDC(bmp))” and changing the font settings works properly. However I cannot use it because I am “painting” on top of a transparent image and I get a different issue with “MemoryDC” alone: the letters are transparent in that case.

Is this a bug in the GCDC class?

Do we have a method available to draw text on top of transparent images where fonts can be properly changed?

Any idea how to solve this??

I also posted the question some days ago in stackoverflow, but no response so far :frowning:
http://stackoverflow.com/questions/20104975/wx-python-gcdc-font-type-problems

Thanks in advance!
Regards,
Jose Antonio.

codeSample.txt (361 Bytes)

Jose Antonio Medina Rodr�guez wrote:

Hi, I am trying to change the font weight when drawing in a bitmap in
GCDC in wxpython. Everything seems to work fine and I can get the text
in my image, however I cannot change some of the font settings. The
size can be changed without problems, but for example the FONTWEIGHT
cannot be changed and I always get the default value (NORMAL instead
of LIGHT).

Please find a sample code attached.

I have tested the same piece of code using "wx.MemoryDC(bmp)" alone
instead of "wx.GCDC(wx.MemoryDC(bmp))" and changing the font settings
works properly. However I cannot use it because I am "painting" on top
of a transparent image and I get a different issue with "MemoryDC"
alone: the letters are transparent in that case.

Is this a bug in the GCDC class?

What font were you expecting to use? You didn't specify that here. If
the default font does not have a lightweight variant, then your weight
choice cannot be honored.

Remember that "SetFont" does not construct a brand-new font that
magically contains of your attributes. Instead, it goes through the
existing font list and chooses the closest existing font that meets your
requirements. Some of the criteria are more important than others. If
it finds an 8-point font in the default family that has a normal weight
but no "light" weight, it will choose that one.

···

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