// Author: Stefan Csomor
// Modified by:
// Created: 1998-01-01
-// RCS-ID: $Id$
// Copyright: (c) Stefan Csomor
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#include <map>
#include <string>
-IMPLEMENT_DYNAMIC_CLASS(wxFont, wxGDIObject)
-
class WXDLLEXPORT wxFontRefData: public wxGDIRefData
{
public:
}
wxFontEncoding GetEncoding() const { return m_info.GetEncoding(); }
+
+ bool IsFixedWidth() const;
void Free();
#define M_FONTDATA ((wxFontRefData*)m_refData)
-wxFontRefData::wxFontRefData(const wxFontRefData& data)
+wxFontRefData::wxFontRefData(const wxFontRefData& data) : wxGDIRefData()
{
Init();
m_info = data.m_info;
Init();
#if wxOSX_USE_CORE_TEXT
- if ( UMAGetSystemVersion() >= 0x1050 )
{
CTFontUIFontType uifont = kCTFontSystemFontType;
switch( font )
m_info.EnsureValid();
#if wxOSX_USE_CORE_TEXT
- if ( UMAGetSystemVersion() >= 0x1050 )
{
CTFontSymbolicTraits traits = 0;
m_fontValid = true;
}
+bool wxFontRefData::IsFixedWidth() const
+{
+#if wxOSX_USE_CORE_TEXT
+ CTFontSymbolicTraits traits = CTFontGetSymbolicTraits(m_ctFont);
+ return (traits & kCTFontMonoSpaceTrait) != 0;
+#else
+ return false;
+#endif
+}
+
// ----------------------------------------------------------------------------
// wxFont
// ----------------------------------------------------------------------------
void wxFont::SetPointSize(int pointSize)
{
- if ( M_FONTDATA->GetPointSize() == pointSize )
+ if ( M_FONTDATA != NULL && M_FONTDATA->GetPointSize() == pointSize )
return;
AllocExclusive();
#endif
}
+bool wxFont::IsFixedWidth() const
+{
+ wxCHECK_MSG( M_FONTDATA != NULL , false, wxT("invalid font") );
+
+ // cast away constness otherwise lazy font resolution is not possible
+ const_cast<wxFont *>(this)->RealizeResource();
+
+ return M_FONTDATA->IsFixedWidth();
+}
+
wxFontFamily wxFont::DoGetFamily() const
{
return M_FONTDATA->GetFamily();
return M_FONTDATA->m_macATSUStyle;
}
-#if WXWIN_COMPATIBILITY_2_8
wxUint32 wxFont::MacGetATSUFontID() const
{
wxCHECK_MSG( M_FONTDATA != NULL, 0, wxT("invalid font") );
}
#endif
-#endif
-
#if wxOSX_USE_CORE_TEXT
CTFontRef wxFont::OSXGetCTFont() const
const wxNativeFontInfo * wxFont::GetNativeFontInfo() const
{
wxCHECK_MSG( M_FONTDATA != NULL , NULL, wxT("invalid font") );
- wxCHECK_MSG( Ok(), NULL, wxT("invalid font") );
+ wxCHECK_MSG( IsOk(), NULL, wxT("invalid font") );
// cast away constness otherwise lazy font resolution is not possible
const_cast<wxFont *>(this)->RealizeResource();
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;
return m_encoding;
}
+bool wxNativeFontInfo::GetStrikethrough() const
+{
+ return false;
+}
+
+
// changing the font descriptor
void wxNativeFontInfo::SetPointSize(int pointsize)
m_encoding = encoding_;
// not reflected in native descriptors
}
+
+void wxNativeFontInfo::SetStrikethrough(bool WXUNUSED(strikethrough))
+{
+}
+
+