+ switch ( style )
+ {
+ case wxFONTSTYLE_ITALIC:
+ pango_font_description_set_style( desc, PANGO_STYLE_ITALIC );
+ break;
+ case wxFONTSTYLE_SLANT:
+ pango_font_description_set_style( desc, PANGO_STYLE_OBLIQUE );
+ break;
+ default:
+ wxFAIL_MSG( _T("unknown font style") );
+ // fall through
+ case wxFONTSTYLE_NORMAL:
+ pango_font_description_set_style( desc, PANGO_STYLE_NORMAL );
+ break;
+ }
+#else
+ if ( HasNativeFont() )
+ {
+ wxString slant;
+ switch ( style )
+ {
+ case wxFONTSTYLE_ITALIC:
+ slant = _T('i');
+ break;
+
+ case wxFONTSTYLE_SLANT:
+ slant = _T('o');
+ break;
+
+ default:
+ wxFAIL_MSG( _T("unknown font style") );
+ // fall through
+
+ case wxFONTSTYLE_NORMAL:
+ slant = _T('r');
+ }
+
+ m_nativeFontInfo.SetXFontComponent(wxXLFD_SLANT, slant);
+ }
+#endif
+}
+
+void wxFontRefData::SetWeight(int weight)
+{
+ m_weight = weight;
+
+#ifdef __WXGTK20__
+ PangoFontDescription *desc = m_nativeFontInfo.description;
+ switch ( weight )
+ {
+ case wxFONTWEIGHT_BOLD:
+ pango_font_description_set_weight(desc, PANGO_WEIGHT_BOLD);
+ break;
+
+ case wxFONTWEIGHT_LIGHT:
+ pango_font_description_set_weight(desc, PANGO_WEIGHT_LIGHT);
+ break;
+
+ default:
+ wxFAIL_MSG( _T("unknown font weight") );
+ // fall through
+
+ case wxFONTWEIGHT_NORMAL:
+ // unspecified
+ pango_font_description_set_weight(desc, PANGO_WEIGHT_NORMAL);
+ }
+#else //!__WXGTK20__
+ if ( HasNativeFont() )
+ {
+ wxString boldness;
+ switch ( weight )
+ {
+ case wxFONTWEIGHT_BOLD:
+ boldness = _T("bold");
+ break;
+
+ case wxFONTWEIGHT_LIGHT:
+ boldness = _T("light");
+ break;
+
+ default:
+ wxFAIL_MSG( _T("unknown font weight") );
+ // fall through
+
+ case wxFONTWEIGHT_NORMAL:
+ // unspecified
+ boldness = _T("medium");
+ }
+
+ m_nativeFontInfo.SetXFontComponent(wxXLFD_WEIGHT, boldness);
+ }
+#endif
+}
+
+void wxFontRefData::SetUnderlined(bool underlined)
+{
+ m_underlined = underlined;
+
+ // the XLFD doesn't have "underlined" field anyhow
+}
+
+void wxFontRefData::SetFaceName(const wxString& facename)
+{
+ m_faceName = facename;
+
+#ifndef __WXGTK20__
+ if ( HasNativeFont() )
+ {
+ m_nativeFontInfo.SetXFontComponent(wxXLFD_FAMILY, facename);
+ }
+#endif
+}
+
+void wxFontRefData::SetEncoding(wxFontEncoding encoding)
+{
+ m_encoding = encoding;
+
+#ifndef __WXGTK20__
+ if ( HasNativeFont() )
+ {
+ wxNativeEncodingInfo info;
+ if ( wxGetNativeFontEncoding(encoding, &info) )
+ {
+ m_nativeFontInfo.SetXFontComponent(wxXLFD_REGISTRY, info.xregistry);
+ m_nativeFontInfo.SetXFontComponent(wxXLFD_ENCODING, info.xencoding);
+ }
+ }
+#endif
+}
+
+void wxFontRefData::SetNativeFontInfo(const wxNativeFontInfo& info)
+{
+ // previously cached fonts shouldn't be used
+ ClearGdkFonts();
+
+ m_nativeFontInfo = info;
+
+ // set all the other font parameters from the native font info
+ InitFromNative();