Opened 12 years ago

Closed 6 years ago

#3583 closed defect (fixed)

wxWindow::SetFont() broken on wxMac

Reported by: pgsnake Owned by: csomor
Priority: normal Milestone:
Component: wxOSX (any toolkit) Version:
Keywords: Cc: pgsnake, csomor
Blocked By: Blocking:
Patch: no


wxWindow::SetFont() has no effect on wxMac 2.6/2.7.
Works as expected (ie. changes the font of controls on
the window) on wxMSW and wxGTK.

Change History (7)

comment:1 Changed 12 years ago by csomor

which controls are you having this on - using which code ? there are some controls that cannot be set, but a few tests on the controls sample show that it still works for some



comment:2 Changed 12 years ago by pgsnake

In pgAdmin we set the font on each wxWindow so that each control inherits the settings (yes, I know it's not very 'Mac', but we've had
a lot of people ask for it! It's mainly used with wxStaticText & wxTextCtrl, but also with wxTreeCtrl, wxListCtrl, wxComboBox and
others. The following patch to the controls sample makes no noticable difference to any of the controls on 2.7.0 (I haven't tested this
on Windows/GTK, but it's essentially the same as the way pgAdmin does it). I'll try to build 2.7.2 tomorrow and try that version.

* controls.orig Sun Nov 12 19:44:18 2006
--- controls.cpp Sun Nov 12 19:57:15 2006
* 1751,1756
--- 1751,1759 ----

: wxFrame(NULL, wxID_ANY, title, wxPoint(x, y), wxSize(700, 450))


+ wxFont fnt = wxFont(wxT("0;14;70;93;90;0;Times New Roman;0"));
+ SetFont(fnt);

SetHelpText( _T("Controls sample demonstrating various widgets") );

Give it an icon

comment:3 Changed 12 years ago by pgsnake

Just tested on Mac with CVS-tip, and with the patch below I
still see no noticable difference to any controls.

With a modified version (a different font string is needed -
wxT("0;-19;0;0;0;400;255;0;0;0;3;2;1;18;Times New Roman") )
on wxMSW 2.7.2, the font for all controls changes as expected.

comment:4 Changed 10 years ago by wxsite

  • Status changed from assigned to confirmed

transitioning old 'assigned' status to new 'confirmed' status

comment:5 Changed 6 years ago by oneeyeman

  • Component changed from wxOSX-Carbon to wxOSX (any toolkit)

This still does not work.

Tested on 10.6 Cocoa build.

comment:6 Changed 6 years ago by csomor

  • Status changed from confirmed to accepted

Some controls have their own font according to HIG, the best way to do some customization is to set the WindowVariant on the Frame before adding controls, that way more space is available without resulting in an ugly appearance, letting the OS decide which font is most appropriate.

Having said that, I'll try to add InheritAttributes and see whether this can be made to work at least...

comment:7 Changed 6 years ago by SC

  • Resolution set to fixed
  • Status changed from accepted to closed

(In [73047]) support for inheriting non-standard attributes (explicit fonts instead of window variants), fixes #3583

Note: See TracTickets for help on using tickets.