X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/02761f6cd478e3c2c97cf6f93442747f7b029833..d968078adbfb147e913b9a33fc54242a36f117ce:/src/os2/settings.cpp diff --git a/src/os2/settings.cpp b/src/os2/settings.cpp index 26b80d7459..b384ebb034 100644 --- a/src/os2/settings.cpp +++ b/src/os2/settings.cpp @@ -16,13 +16,14 @@ #include #include "wx/pen.h" #include "wx/brush.h" - #include "wx/fontutil.h" #include "wx/gdicmn.h" #include "wx/window.h" #include "wx/settings.h" #include "wx/module.h" #endif +#include "wx/fontutil.h" + #include "wx/os2/private.h" // the module which is used to clean up wxSystemSettings data (this is a @@ -206,26 +207,6 @@ wxColour wxSystemSettingsNative::GetColour( // fonts // ---------------------------------------------------------------------------- -wxFont wxCreateFontFromStockObject(int index) -{ - wxFont font; - - FONTMETRICS metrics; - HPS hPS = ::WinGetScreenPS(HWND_DESKTOP); - if (::GpiQueryFontMetrics(hPS, sizeof(FONTMETRICS), &metrics)) - { - wxNativeFontInfo info; - info.fm = metrics; - font.Create(info); - } - else // GetStockObject() failed - { - wxFAIL_MSG( _T("stock font not found") ); - } - - return font; -} - wxFont wxSystemSettingsNative::GetFont( wxSystemFont index ) @@ -237,7 +218,40 @@ wxFont wxSystemSettingsNative::GetFont( return *gs_fontDefault; } - wxFont font = wxCreateFontFromStockObject(index); + wxFont font; + // FIXME: The mapping could be improved and also OS/2 system fonts + // should be taken into account e.g. by using PrfQueryProfileString + // to look for PM_System_Fonts in HINI_USERPROFILE. + // FIXME2: Creating a font from the native font info does not + // seem to work properly. + switch (index) + { + case wxSYS_SYSTEM_FIXED_FONT: + case wxSYS_OEM_FIXED_FONT: + case wxSYS_ANSI_FIXED_FONT: + font.Create( 10, + wxFONTFAMILY_TELETYPE, + wxFONTSTYLE_NORMAL, + wxFONTWEIGHT_NORMAL ); + break; + case wxSYS_ANSI_VAR_FONT: + font.Create( 10, + wxFONTFAMILY_MODERN, + wxFONTSTYLE_NORMAL, + wxFONTWEIGHT_NORMAL ); + break; + case wxSYS_SYSTEM_FONT: + case wxSYS_DEFAULT_GUI_FONT: + font.Create( 10, + wxFONTFAMILY_SWISS, + wxFONTSTYLE_NORMAL, + wxFONTWEIGHT_NORMAL ); + break; + default: + wxFAIL_MSG( _T("stock font not found") ); + return GetFont(wxSYS_ANSI_VAR_FONT); + } + if ( isDefaultRequested ) {