+ m_underlined = underlined;
+ m_encoding = encoding;
+
+#if wxUSE_UNICODE
+ if ( m_nativeFontInfo.description )
+ pango_font_description_free(m_nativeFontInfo.description);
+
+ // Create native font info
+ m_nativeFontInfo.description = pango_font_description_new();
+
+ // if a face name is specified, use it if it's available, otherwise use
+ // just the family
+ if ( faceName.empty() || !wxFontEnumerator::IsValidFacename(faceName) )
+ {
+ // TODO: scan system for valid fonts matching the given family instead
+ // of hardcoding them here
+ switch ( m_family )
+ {
+ case wxFONTFAMILY_TELETYPE:
+ m_faceName = wxT("monospace");
+ break;
+
+ case wxFONTFAMILY_ROMAN:
+ m_faceName = wxT("serif");
+ break;
+
+ default:
+ m_faceName = wxT("sans");
+ }
+ }
+ else // specified face name is available, use it
+ {
+ m_faceName = faceName;
+ }
+
+ m_nativeFontInfo.SetFaceName(m_faceName);
+ m_nativeFontInfo.SetWeight((wxFontWeight)m_weight);
+ m_nativeFontInfo.SetStyle((wxFontStyle)m_style);
+#endif // wxUSE_UNICODE
+
+ SetPointSize(pointSize);
+}
+
+void wxFontRefData::InitFromNative()
+{
+#if wxUSE_UNICODE
+ // Get native info
+ PangoFontDescription *desc = m_nativeFontInfo.description;
+
+ // init fields
+ m_faceName = wxGTK_CONV_BACK( pango_font_description_get_family( desc ) );
+
+ m_pointSize = pango_font_description_get_size( desc ) / PANGO_SCALE;
+
+ switch (pango_font_description_get_style( desc ))
+ {
+ case PANGO_STYLE_NORMAL:
+ m_style = wxFONTSTYLE_NORMAL;
+ break;
+ case PANGO_STYLE_ITALIC:
+ m_style = wxFONTSTYLE_ITALIC;
+ break;
+ case PANGO_STYLE_OBLIQUE:
+ m_style = wxFONTSTYLE_SLANT;
+ break;
+ }
+
+// Not defined in some Pango versions
+#define wxPANGO_WEIGHT_SEMIBOLD 600
+
+ switch (pango_font_description_get_weight( desc ))
+ {
+ case PANGO_WEIGHT_ULTRALIGHT:
+ case PANGO_WEIGHT_LIGHT:
+ m_weight = wxFONTWEIGHT_LIGHT;
+ break;
+
+ default:
+ wxFAIL_MSG(wxT("unknown Pango font weight"));
+ // fall through
+
+ case PANGO_WEIGHT_NORMAL:
+ m_weight = wxFONTWEIGHT_NORMAL;
+ break;
+
+ case wxPANGO_WEIGHT_SEMIBOLD:
+ case PANGO_WEIGHT_BOLD:
+ case PANGO_WEIGHT_ULTRABOLD:
+ case PANGO_WEIGHT_HEAVY:
+ m_weight = wxFONTWEIGHT_BOLD;
+ break;
+ }
+
+ if (m_faceName == wxT("monospace"))
+ {
+ m_family = wxFONTFAMILY_TELETYPE;
+ }
+ else if (m_faceName == wxT("sans"))
+ {
+ m_family = wxFONTFAMILY_SWISS;
+ }