[wxPython-users] Setting size for wx.FontFromPixelSize

Christopher Barker Chris.Barker at noaa.gov
Tue May 1 15:17:21 PDT 2007


jmf wrote:
> This will not help, it may give some infos.

Thanks, more info the better.

> I will not be suprised
> if the FontFromPixelSize function is a wrapper around the
> CreateFont function or something like this.

Yes, I think that's the case. The docs indicate that it makes a direct 
call on MSW, and emulates it on the other platforms.

I just wish you could pass in a default width some how.

Anyway, what I've done instead is just do wxDC.GetTextExtent on an "X" 
to see what the pixel size to point size ratio is, then use that to 
scale all font calls. I've isolated the code well, so there are only two 
font-creating calls in FloatCanvas anyway, so it's not a big deal.

thanks,

-Chris

-- 
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

Chris.Barker at noaa.gov




More information about the wxpython-users mailing list