Copy fonts more faithfully and efficiently in wxGTK

Use pango_font_description_copy() to copy fonts instead of
pango_font_description_to_string() and pango_font_description_from_string()
via wxNativeFontInfo::{To,From}String() respectively.

This is not only more efficient but also preserves the original family whereas
wxNativeFontInfo::FromString() helpfully replaces any fonts it doesn't know
about with the normal font name. That behaviour is probably wrong on its own,
but for now at least avoid silently changing fonts when copying them.
This commit is contained in:
Vadim Zeitlin 2015-09-16 03:39:07 +02:00
parent 7e8c2cc4a5
commit 07380ba0b5

View File

@ -161,12 +161,9 @@ void wxFontRefData::InitFromNative()
}
wxFontRefData::wxFontRefData( const wxFontRefData& data )
: wxGDIRefData()
: wxGDIRefData(),
m_nativeFontInfo(data.m_nativeFontInfo)
{
// Forces a copy of the internal data. wxNativeFontInfo should probably
// have a copy ctor and assignment operator to fix this properly but that
// would break binary compatibility...
m_nativeFontInfo.FromString(data.m_nativeFontInfo.ToString());
}
wxFontRefData::wxFontRefData(int size, wxFontFamily family, wxFontStyle style,