X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/da0a6b013bc904f772161daa7e8aa3b653437454..b4446c244775324631b8dd2b588ea35f32e71728:/src/mac/classic/font.cpp diff --git a/src/mac/classic/font.cpp b/src/mac/classic/font.cpp index 06e7fa1ca3..09feb155c6 100644 --- a/src/mac/classic/font.cpp +++ b/src/mac/classic/font.cpp @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: font.cpp +// Name: src/mac/classic/font.cpp // Purpose: wxFont class // Author: Stefan Csomor // Modified by: @@ -9,25 +9,28 @@ // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// -#ifdef __GNUG__ -#pragma implementation "font.h" +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop #endif -#include "wx/defs.h" -#include "wx/string.h" #include "wx/font.h" + +#ifndef WX_PRECOMP + #include "wx/string.h" + #include "wx/utils.h" +#endif + #include "wx/fontutil.h" #include "wx/gdicmn.h" -#include "wx/utils.h" #include "wx/fontutil.h" #include "wx/mac/private.h" #include -#if !USE_SHARED_LIBRARIES IMPLEMENT_DYNAMIC_CLASS(wxFont, wxGDIObject) -#endif class WXDLLEXPORT wxFontRefData: public wxGDIRefData { @@ -39,7 +42,7 @@ public: , m_family(wxDEFAULT) , m_style(wxNORMAL) , m_weight(wxNORMAL) - , m_underlined(FALSE) + , m_underlined(false) , m_faceName(wxT("Geneva")) , m_encoding(wxFONTENCODING_DEFAULT) , m_macFontNum(0) @@ -47,7 +50,7 @@ public: , m_macFontStyle(0) , m_macATSUFontID() { - Init(10, wxDEFAULT, wxNORMAL, wxNORMAL, FALSE, + Init(10, wxDEFAULT, wxNORMAL, wxNORMAL, false, wxT("Geneva"), wxFONTENCODING_DEFAULT); } @@ -94,9 +97,9 @@ public: } virtual ~wxFontRefData(); - void SetNoAntiAliasing( bool no = TRUE ) { m_noAA = no; } + void SetNoAntiAliasing( bool no = true ) { m_noAA = no; } bool GetNoAntiAliasing() const { return m_noAA; } - + protected: // common part of all ctors void Init(int size, @@ -116,8 +119,8 @@ protected: bool m_underlined; wxString m_faceName; wxFontEncoding m_encoding; - bool m_noAA; // No anti-aliasing - + bool m_noAA; // No anti-aliasing + public: short m_macFontNum; short m_macFontSize; @@ -158,7 +161,7 @@ void wxFontRefData::Init(int pointSize, m_macFontSize = 0; m_macFontStyle = 0; m_fontId = 0; - m_noAA = FALSE; + m_noAA = false; } wxFontRefData::~wxFontRefData() @@ -167,7 +170,7 @@ wxFontRefData::~wxFontRefData() void wxFontRefData::MacFindFont() { - if( m_faceName.Length() == 0 ) + if( m_faceName.empty() ) { switch( m_family ) { @@ -211,19 +214,19 @@ void wxFontRefData::MacFindFont() m_macFontStyle = 0; if (m_weight == wxBOLD) m_macFontStyle |= bold; - if (m_style == wxITALIC || m_style == wxSLANT) + if (m_style == wxITALIC || m_style == wxSLANT) m_macFontStyle |= italic; - if (m_underlined) + if (m_underlined) m_macFontStyle |= underline; m_macFontSize = m_pointSize ; - + //TODO:if we supply the style as an additional parameter we must make a testing //sequence in order to degrade gracefully while trying to maintain most of the style //information, meanwhile we just take the normal font and apply the features after #ifdef __WXDEBUG__ OSStatus status = #endif // __WXDEBUG__ - ::ATSUFONDtoFontID(m_macFontNum, normal /*qdStyle*/, (UInt32*)&m_macATSUFontID); + ::ATSUFONDtoFontID(m_macFontNum, normal /*qdStyle*/, (UInt32*)&m_macATSUFontID); /* status = ATSUFindFontFromName ( (Ptr) m_faceName , strlen( m_faceName ) , kFontFullName, kFontMacintoshPlatform, kFontRomanScript , kFontNoLanguage , (UInt32*)&m_macATSUFontID ) ; @@ -234,9 +237,6 @@ void wxFontRefData::MacFindFont() // ---------------------------------------------------------------------------- // wxFont // ---------------------------------------------------------------------------- - -void wxFont::Init() -{ } bool wxFont::Create(const wxNativeFontInfo& info) @@ -266,7 +266,7 @@ bool wxFont::Create(int pointSize, RealizeResource(); - return TRUE; + return true; } wxFont::~wxFont() @@ -276,7 +276,7 @@ wxFont::~wxFont() bool wxFont::RealizeResource() { M_FONTDATA->MacFindFont() ; - return TRUE; + return true; } void wxFont::SetEncoding(wxFontEncoding encoding) @@ -443,4 +443,3 @@ const wxNativeFontInfo *wxFont::GetNativeFontInfo() const return &(M_FONTDATA->m_info); } -