From 3b0e208f3fc2ab582687ab9bba5de2f4279d51c1 Mon Sep 17 00:00:00 2001 From: Stefan Neis Date: Sun, 22 Oct 2006 18:59:15 +0000 Subject: [PATCH] Reverted font breakage caused by changes in version 1.30. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@42245 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/os2/settings.cpp | 55 +++++++++++++++++++++++++++----------------- 1 file changed, 34 insertions(+), 21 deletions(-) diff --git a/src/os2/settings.cpp b/src/os2/settings.cpp index 8370e46b16..b384ebb034 100644 --- a/src/os2/settings.cpp +++ b/src/os2/settings.cpp @@ -207,26 +207,6 @@ wxColour wxSystemSettingsNative::GetColour( // fonts // ---------------------------------------------------------------------------- -wxFont wxCreateFontFromStockObject(int WXUNUSED(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 ) @@ -238,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 ) { -- 2.45.2