From d395f181b3980e2232c00dae89b949c58be1cf53 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 28 Nov 2009 02:28:57 +0000 Subject: [PATCH 1/1] Use OUTLINETEXTMETRIC::otmpFamilyName to get wxFont face name from MSW. In spite of the name, we need to use otmpFamilyName member of OUTLINETEXTMETRIC struct and not otmpFaceName to get the font face name: the latter may contain (locale-dependent, so the changes of r62708 didn't work for non-English versions of Windows) "Italic" or "Bold" suffix while the former does not and is what we want. This should really fix the unit test failures, even in French locale. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62732 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/msw/font.cpp | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/src/msw/font.cpp b/src/msw/font.cpp index 832ce661a8..499478eace 100644 --- a/src/msw/font.cpp +++ b/src/msw/font.cpp @@ -189,14 +189,6 @@ public: facename = GetMSWFaceName(); if ( !facename.empty() ) { - // the face name returned by GetOutlineTextMetrics() may have - // these suffixes which we don't count as part of face name - // because we have separate fields for them so remove them - wxString basename; - if ( facename.EndsWith(wxS(" Italic"), &basename) || - facename.EndsWith(wxS(" Bold"), &basename) ) - facename = basename; - // cache the face name, it shouldn't change unless the family // does and wxNativeFontInfo::SetFamily() resets the face name const_cast(this)->SetFaceName(facename); @@ -354,11 +346,14 @@ protected: return wxString(); } - // in spite of its type, the otmpFaceName field of OUTLINETEXTMETRIC - // gives an offset in _bytes_ of the face name from the struct start - // while the name itself is an array of TCHARs + // in spite of its type, the otmpFamilyName field of OUTLINETEXTMETRIC + // gives an offset in _bytes_ of the face (not family!) name from the + // struct start while the name itself is an array of TCHARs + // + // FWIW otmpFaceName contains the same thing as otmpFamilyName followed + // by a possible " Italic" or " Bold" or something else suffix return reinterpret_cast(otm) + - wxPtrToUInt(otm->otmpFaceName)/sizeof(wxChar); + wxPtrToUInt(otm->otmpFamilyName)/sizeof(wxChar); } // are we using m_nativeFontInfo.lf.lfHeight for point size or pixel size? -- 2.45.2