Bug in wxFont

Hi Robin,

win98se, Py 2.3, wxPy 2.4.2.4

Thanks for the reply. Previous message:

Hi,

win98, Py 2.3, wxPy 2.4.2.4

Independently of the used font (monospaced or not),
fo.IsFixedWidth() *always* returns 0 (False)
Same problem with fo.GetNativeFontInfoDesc()

Works here. In what context are you trying to use it? How is the font
created?

Unless I'm doing a stupid mistake in my code (see below), it seems, this is
really not working on my platform. Same problem with button, text control,....
It also seems to be independent of the window type , wxFrame, wxDialog.
However, the others returned parameters, GetFaceName, GetFamily,...
are ok. Is this due to one of these font handling differences between win9x
and win NT/2000 ?

Off topic Best wishes for the wx 2.5. I hope to see an alpha, canditate release
for end user soon. Christmas gift?

Jean-Michel Fauth, Switzerland

#-*- coding: iso-8859-1 -*-

···

#-------------------------------------------------------------------
# testfont.py
# Py 2.3, wxPy 2.4.2.4, win98se
# 15 November 2003
#-------------------------------------------------------------------

from wxPython.wx import *

#-------------------------------------------------------------------

class MyPanel(wxPanel):
    
    def __init__(self, parent, id):
        wxPanel.__init__(self, parent, id, wxDefaultPosition, wxDefaultSize)
    
        self.statxt = wxStaticText(self, -1, 'abc def 012', wxPoint(20, 20), wxSize(300, 200), wxST_NO_AUTORESIZE)
        
        #~ UsedFont = self.statxt.GetFont()
        #~ print UsedFont.IsFixedWidth()
        #~ print UsedFont.GetNativeFontInfoDesc()

        self.statxt.SetBackgroundColour(wxWHITE)
        #~ self.statxt.SetFont(wxFont(10, wxMODERN, wxNORMAL, wxNORMAL, False))
        #~ self.statxt.SetFont(wxFont(10, wxMODERN, wxNORMAL, wxNORMAL, False, 'Courier New'))
        #~ self.statxt.SetFont(wxFont(10, wxDEFAULT, wxNORMAL, wxNORMAL, False))
        #~ self.statxt.SetFont(wxFont(10, wxROMAN, wxNORMAL, wxNORMAL, False))
        #~ self.statxt.SetFont(wxFont(10, wxMODERN, wxNORMAL, wxNORMAL, False))
        #~ self.statxt.SetFont(wxFont(10, wxMODERN, wxNORMAL, wxNORMAL, False, 'Lucida Console'))
        self.statxt.SetFont(wxFont(10, wxMODERN, wxNORMAL, wxNORMAL, False, 'Andale Mono'))
    
        UsedFont = self.statxt.GetFont()
        print UsedFont.IsFixedWidth()
        print UsedFont.GetNativeFontInfoDesc()

#-------------------------------------------------------------------

class MyFrame(wxFrame):

    def __init__(self, parent, id):
        wxFrame.__init__(self, parent, id, 'testfont', wxPoint(10,10), wxSize(400, 400))
        
        panel = MyPanel(self, -1)

        EVT_CLOSE(self, self.OnCloseWindow)

    def OnCloseWindow(self, event):
        self.Destroy()

#-------------------------------------------------------------------

class MyApp(wxApp):
    
    def OnInit(self):
        frame = MyFrame(None, -1)
        frame.Show(True)
        self.SetTopWindow(frame)
        return True

#-------------------------------------------------------------------

def main():
    print 'main is running...'
    app = MyApp(0)
    app.MainLoop()

#-------------------------------------------------------------------

if __name__ == "__main__" :
    main()

#eof-------------------------------------------------------------------
.

Jean-Michel Fauth wrote:

Hi Robin,

win98se, Py 2.3, wxPy 2.4.2.4

Thanks for the reply. Previous message:

Hi,

win98, Py 2.3, wxPy 2.4.2.4

Independently of the used font (monospaced or not),
fo.IsFixedWidth() *always* returns 0 (False)
Same problem with fo.GetNativeFontInfoDesc()

Works here. In what context are you trying to use it? How is the font created?

Unless I'm doing a stupid mistake in my code (see below), it seems, this is
really not working on my platform. Same problem with button, text control,.... It also seems to be independent of the window type , wxFrame, wxDialog.
However, the others returned parameters, GetFaceName, GetFamily,...
are ok. Is this due to one of these font handling differences between win9x and win NT/2000 ?

No, you are correct and it doesn't seem to be working correctly. I was testing with wxFontDialog and it does work there. Please enter a bug report about it.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!