[wxGTK2] Return wxTELETYPE with GetFamily() for monospaced fonts, fixing IsFixedWidth() after it broke completely
after get accessor changes, and returning the right thing in GetFamily() in this case. Other families TODO. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@35268 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
b578601e3e
commit
38d446db26
@ -45,6 +45,7 @@
|
|||||||
|
|
||||||
#ifdef __WXGTK20__
|
#ifdef __WXGTK20__
|
||||||
#include "wx/gtk/private.h"
|
#include "wx/gtk/private.h"
|
||||||
|
extern GtkWidget *wxGetRootWindow();
|
||||||
#else
|
#else
|
||||||
#include "wx/x11/private.h"
|
#include "wx/x11/private.h"
|
||||||
#endif
|
#endif
|
||||||
@ -137,6 +138,42 @@ wxString wxNativeFontInfo::GetFaceName() const
|
|||||||
|
|
||||||
wxFontFamily wxNativeFontInfo::GetFamily() const
|
wxFontFamily wxNativeFontInfo::GetFamily() const
|
||||||
{
|
{
|
||||||
|
#ifndef HAVE_PANGO_FONT_FAMILY_IS_MONOSPACE
|
||||||
|
if (g_ascii_strcasecmp( pango_font_description_get_family( description ), "monospace" ) == 0)
|
||||||
|
return wxFONTFAMILY_TELETYPE;
|
||||||
|
#else
|
||||||
|
|
||||||
|
PangoFontFamily **families;
|
||||||
|
PangoFontFamily *family;
|
||||||
|
int n_families;
|
||||||
|
pango_context_list_families(
|
||||||
|
#ifdef __WXGTK20__
|
||||||
|
gtk_widget_get_pango_context( wxGetRootWindow() ),
|
||||||
|
#else
|
||||||
|
wxTheApp->GetPangoContext(),
|
||||||
|
#endif
|
||||||
|
&families, &n_families);
|
||||||
|
|
||||||
|
for (int i = 0;i < n_families;++i)
|
||||||
|
{
|
||||||
|
if (g_ascii_strcasecmp(pango_font_family_get_name( families[i] ), pango_font_description_get_family( description )) == 0 )
|
||||||
|
{
|
||||||
|
family = families[i];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
g_free(families);
|
||||||
|
|
||||||
|
wxASSERT_MSG( family, wxT("wxNativeFontInfo::GetFamily() - No appropriate PangoFontFamily found for ::description") );
|
||||||
|
|
||||||
|
//BCI: Cache the wxFontFamily inside the class. Validate cache with
|
||||||
|
//BCI: g_ascii_strcasecmp(pango_font_description_get_family(description), pango_font_family_get_name(family)) == 0
|
||||||
|
|
||||||
|
if (pango_font_family_is_monospace( family ))
|
||||||
|
return wxFONTFAMILY_TELETYPE;
|
||||||
|
#endif // pango_font_family_is_monospace
|
||||||
|
|
||||||
return wxFONTFAMILY_SWISS;
|
return wxFONTFAMILY_SWISS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user