Skip to content

Commit

Permalink
Avoid infinite recursion between wxStockGDI and wxSystemSettions
Browse files Browse the repository at this point in the history
There was a possible recursion from wxStockGDI::GetFont to
wxSystemSettings::GetFont and back, resolve by using direct font
creation, adding fixed system font.
  • Loading branch information
csomor authored and Paul-Licameli committed Dec 2, 2020
1 parent 58ad95e commit 07e7d83
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
3 changes: 2 additions & 1 deletion include/wx/osx/font.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ enum wxOSXSystemFont
wxOSX_SYSTEM_FONT_MINI,
wxOSX_SYSTEM_FONT_MINI_BOLD,
wxOSX_SYSTEM_FONT_LABELS,
wxOSX_SYSTEM_FONT_VIEWS
wxOSX_SYSTEM_FONT_VIEWS,
wxOSX_SYSTEM_FONT_FIXED
};


Expand Down
2 changes: 2 additions & 0 deletions src/osx/carbon/font.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -471,6 +471,8 @@ wxFont::wxFont(wxOSXSystemFont font)
case wxOSX_SYSTEM_FONT_VIEWS:
uifont = kCTFontViewsFontType;
break;
case wxOSX_SYSTEM_FONT_FIXED:
uifont = kCTFontUIFontUserFixedPitch;
default:
break;
}
Expand Down
4 changes: 2 additions & 2 deletions src/osx/cocoa/settings.mm
Original file line number Diff line number Diff line change
Expand Up @@ -196,15 +196,15 @@ static int wxOSXGetUserDefault(NSString* key, int defaultValue)
case wxSYS_DEVICE_DEFAULT_FONT :
case wxSYS_DEFAULT_GUI_FONT :
{
return *wxSMALL_FONT ;
return wxFont(wxOSX_SYSTEM_FONT_SMALL) ;
} ;
break ;
case wxSYS_OEM_FIXED_FONT :
case wxSYS_ANSI_FIXED_FONT :
case wxSYS_SYSTEM_FIXED_FONT :
default :
{
return *wxNORMAL_FONT ;
return wxFont(wxOSX_SYSTEM_FONT_FIXED) ;
} ;
break ;

Expand Down

0 comments on commit 07e7d83

Please sign in to comment.