From 79bf5de2bb0840349b18fc3db275ff2f8573d9bd Mon Sep 17 00:00:00 2001 From: Robert Roebling Date: Mon, 1 Dec 2003 09:37:35 +0000 Subject: [PATCH] Native fonts now seem to require a font size. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_4_BRANCH@24692 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/gtk/font.cpp | 7 +++++++ src/gtk1/font.cpp | 7 +++++++ src/unix/fontutil.cpp | 2 +- 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/gtk/font.cpp b/src/gtk/font.cpp index 23a8b2b1f0..e2eefe6335 100644 --- a/src/gtk/font.cpp +++ b/src/gtk/font.cpp @@ -232,8 +232,15 @@ void wxFontRefData::InitFromNative() // init fields m_faceName = wxGTK_CONV_BACK( pango_font_description_get_family( desc ) ); + + // Pango sometimes needs to have a size + int pango_size = pango_font_description_get_size( desc ); + if (pango_size == 0) + pango_font_description_set_size( desc, 12 * PANGO_SCALE); m_pointSize = pango_font_description_get_size( desc ) / PANGO_SCALE; + + // wxPrintf( wxT("face %s m_pointSize %d\n"), m_faceName.c_str(), m_pointSize ); switch (pango_font_description_get_style( desc )) { diff --git a/src/gtk1/font.cpp b/src/gtk1/font.cpp index 23a8b2b1f0..e2eefe6335 100644 --- a/src/gtk1/font.cpp +++ b/src/gtk1/font.cpp @@ -232,8 +232,15 @@ void wxFontRefData::InitFromNative() // init fields m_faceName = wxGTK_CONV_BACK( pango_font_description_get_family( desc ) ); + + // Pango sometimes needs to have a size + int pango_size = pango_font_description_get_size( desc ); + if (pango_size == 0) + pango_font_description_set_size( desc, 12 * PANGO_SCALE); m_pointSize = pango_font_description_get_size( desc ) / PANGO_SCALE; + + // wxPrintf( wxT("face %s m_pointSize %d\n"), m_faceName.c_str(), m_pointSize ); switch (pango_font_description_get_style( desc )) { diff --git a/src/unix/fontutil.cpp b/src/unix/fontutil.cpp index 3474da8048..5cb29cba4f 100644 --- a/src/unix/fontutil.cpp +++ b/src/unix/fontutil.cpp @@ -139,7 +139,7 @@ bool wxNativeFontInfo::FromString( const wxString& str ) description = pango_font_description_from_string( wxGTK_CONV( str ) ); - // wxPrintf( L"FromString result: %s\n", ToString().c_str() ); + // wxPrintf( L"FromString before: %s result: %s\n", str.c_str(), ToString().c_str() ); return TRUE; }