In FindOrCreateFont(), avoid using family if facenames are specified.

GetFamily() is not reliable in wxGTK. See #17313
This commit is contained in:
Paul Cornett
2016-01-08 09:56:28 -08:00
parent c5659b19b4
commit 2585d73204

View File

@@ -793,20 +793,18 @@ wxFont *wxFontList::FindOrCreateFont(int pointSize,
font->GetWeight () == weight && font->GetWeight () == weight &&
font->GetUnderlined () == underline ) font->GetUnderlined () == underline )
{ {
bool same = font->GetFamily() == family;
// empty facename matches anything at all: this is bad because // empty facename matches anything at all: this is bad because
// depending on which fonts are already created, we might get back // depending on which fonts are already created, we might get back
// a different font if we create it with empty facename, but it is // a different font if we create it with empty facename, but it is
// still better than never matching anything in the cache at all // still better than never matching anything in the cache at all
// in this case // in this case
if ( same && !facename.empty() ) bool same;
{ const wxString fontFaceName(font->GetFaceName());
const wxString& fontFace = font->GetFaceName();
// empty facename matches everything if (facename.empty() || fontFaceName.empty())
same = !fontFace || fontFace == facename; same = font->GetFamily() == family;
} else
same = fontFaceName == facename;
if ( same && (encoding != wxFONTENCODING_DEFAULT) ) if ( same && (encoding != wxFONTENCODING_DEFAULT) )
{ {