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
This commit is contained in:
Vadim Zeitlin
2009-11-28 02:28:57 +00:00
parent 9a67941f0b
commit d395f181b3

View File

@@ -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<wxFontRefData *>(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<wxChar *>(otm) +
wxPtrToUInt(otm->otmpFaceName)/sizeof(wxChar);
wxPtrToUInt(otm->otmpFamilyName)/sizeof(wxChar);
}
// are we using m_nativeFontInfo.lf.lfHeight for point size or pixel size?