From 659ca93c425faabda30fce9dee68b38cb6868d14 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Tue, 30 Apr 2013 10:27:32 +0000 Subject: [PATCH] Allow using wxDEFAULT as font size in wxOSX. Using wxDEFAULT as the font size in wxOSX resulted in creating 70pt font, change this to use the normal font size instead for compatibility with the other platforms. Also allow using -1 as wxDEFAULT for compatibility with wxGTK, see #12541. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@73884 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/osx/carbon/font.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/osx/carbon/font.cpp b/src/osx/carbon/font.cpp index 634453ec6a..d6c35540fb 100644 --- a/src/osx/carbon/font.cpp +++ b/src/osx/carbon/font.cpp @@ -1112,7 +1112,16 @@ void wxNativeFontInfo::Init(int size, wxFontEncoding encoding) { Init(); - m_pointSize = size; + + // We should use the default font size if the special value wxDEFAULT is + // specified and we also handle -1 as a synonym for wxDEFAULT for + // compatibility with wxGTK (see #12541). + // + // Notice that we rely on the fact that wxNORMAL_FONT itself is not + // initialized using this ctor, but from native font info. + m_pointSize = size == -1 || size == wxDEFAULT + ? wxNORMAL_FONT->GetPointSize() + : size; m_family = family; m_style = style; m_weight = weight; -- 2.47.2