From 05ed6a12d452b2b8f6106409d70c947a8a67ad44 Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Mon, 15 Sep 2003 19:27:47 +0000 Subject: [PATCH] Ensure that the native font is initialized so the face name and such are valid git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_4_BRANCH@23607 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- contrib/src/stc/stc.cpp | 5 +++++ contrib/src/stc/stc.cpp.in | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/contrib/src/stc/stc.cpp b/contrib/src/stc/stc.cpp index a9eea5d814..534196f551 100644 --- a/contrib/src/stc/stc.cpp +++ b/contrib/src/stc/stc.cpp @@ -2037,6 +2037,11 @@ void wxStyledTextCtrl::StyleSetSpec(int styleNum, const wxString& spec) { // Set style size, face, bold, italic, and underline attributes from // a wxFont's attributes. void wxStyledTextCtrl::StyleSetFont(int styleNum, wxFont& font) { +#ifdef __WXGTK__ + // Ensure that the native font is initialized + int x, y; + GetTextExtent(wxT("X"), &x, &y, NULL, NULL, &font); +#endif int size = font.GetPointSize(); wxString faceName = font.GetFaceName(); bool bold = font.GetWeight() == wxBOLD; diff --git a/contrib/src/stc/stc.cpp.in b/contrib/src/stc/stc.cpp.in index 60360d977e..c339d40d8f 100644 --- a/contrib/src/stc/stc.cpp.in +++ b/contrib/src/stc/stc.cpp.in @@ -242,6 +242,11 @@ void wxStyledTextCtrl::StyleSetSpec(int styleNum, const wxString& spec) { // Set style size, face, bold, italic, and underline attributes from // a wxFont's attributes. void wxStyledTextCtrl::StyleSetFont(int styleNum, wxFont& font) { +#ifdef __WXGTK__ + // Ensure that the native font is initialized + int x, y; + GetTextExtent(wxT("X"), &x, &y, NULL, NULL, &font); +#endif int size = font.GetPointSize(); wxString faceName = font.GetFaceName(); bool bold = font.GetWeight() == wxBOLD;