- if (!g_systemDefaultGuiFont)
- {
- GtkWidget *widget = gtk_button_new();
- GtkStyle *def = gtk_rc_get_style( widget );
- if (def)
- {
- g_systemDefaultGuiFont = gdk_font_ref( def->font );
- }
- else
- {
- def = gtk_widget_get_default_style();
- if (def)
- g_systemDefaultGuiFont = gdk_font_ref( def->font );
- }
- gtk_widget_destroy( widget );
- }
- return g_systemDefaultGuiFont;
-}
-
-GdkFont *wxFont::GetInternalFont( float scale ) const
-{
- if (!Ok())
- {
- wxFAIL_MSG( wxT("invalid font") );
-
- return (GdkFont*) NULL;
- }
-
- long int_scale = long(scale * 100.0 + 0.5); /* key for fontlist */
- int point_scale = (int)((M_FONTDATA->m_pointSize * 10 * int_scale) / 100);
- GdkFont *font = (GdkFont *) NULL;
-
- wxNode *node = M_FONTDATA->m_scaled_xfonts.Find(int_scale);
- if (node)
- {
- font = (GdkFont*)node->Data();
- }
- else
- {
- if (*this == wxSystemSettings::GetSystemFont( wxSYS_DEFAULT_GUI_FONT))
- {
- font = GtkGetDefaultGuiFont();
- }
- if (!font)
- {
- font = wxLoadQueryNearestFont( point_scale,
- M_FONTDATA->m_family,
- M_FONTDATA->m_style,
- M_FONTDATA->m_weight,
- M_FONTDATA->m_underlined,
- M_FONTDATA->m_faceName,
- M_FONTDATA->m_encoding,
- &M_FONTDATA->m_nativeFontInfo.xFontName );
- }
-
- M_FONTDATA->m_scaled_xfonts.Append( int_scale, (wxObject*)font );
- }
-
- // it's quite useless to make it a wxCHECK because we're going to crash
- // anyhow...
- wxASSERT_MSG( font, wxT("could not load any font?") );