X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/dd05139a8023fd3e30476409fafbe04221c6d627..83f787ba2137594f12c7bd0659dc3c2fb973598f:/src/mac/carbon/font.cpp diff --git a/src/mac/carbon/font.cpp b/src/mac/carbon/font.cpp index ff9671bd6c..7766ff4e53 100644 --- a/src/mac/carbon/font.cpp +++ b/src/mac/carbon/font.cpp @@ -21,7 +21,7 @@ #endif #include "wx/fontutil.h" -#include "wx/fontutil.h" +#include "wx/graphics.h" #include "wx/mac/private.h" @@ -154,6 +154,8 @@ public: wxNativeFontInfo m_info; }; +#define M_FONTDATA ((wxFontRefData*)m_refData) + // ============================================================================ // implementation @@ -220,8 +222,9 @@ void wxFontRefData::MacFindFont() if ( m_macFontStyle & underline ) m_underlined = true ; m_pointSize = m_macFontSize ; - +#ifndef __LP64__ m_macFontFamily = FMGetFontFamilyFromName( qdFontName ); +#endif } else { @@ -229,9 +232,11 @@ void wxFontRefData::MacFindFont() { if ( m_family == wxDEFAULT ) { +#ifndef __LP64__ m_macFontFamily = GetAppFont(); FMGetFontFamilyName(m_macFontFamily,qdFontName); m_faceName = wxMacMakeStringFromPascal( qdFontName ); +#endif } else { @@ -255,17 +260,26 @@ void wxFontRefData::MacFindFont() m_faceName = wxT("Times"); break ; } +#ifndef __LP64__ wxMacStringToPascal( m_faceName , qdFontName ); m_macFontFamily = FMGetFontFamilyFromName( qdFontName ); +#endif } } else { +#ifndef __LP64__ if ( m_faceName == wxT("systemfont") ) m_macFontFamily = GetSysFont(); else if ( m_faceName == wxT("applicationfont") ) m_macFontFamily = GetAppFont(); else +#else + if ( m_faceName == wxT("systemfont") ) + m_faceName = wxT("Lucida Grande"); + else if ( m_faceName == wxT("applicationfont") ) + m_faceName = wxT("Lucida Grande"); +#endif { wxMacCFStringHolder cf( m_faceName, wxLocale::GetSystemEncoding() ); ATSFontFamilyRef atsfamily = ATSFontFamilyFindFromName( cf , kATSOptionFlagsDefault ); @@ -289,9 +303,10 @@ void wxFontRefData::MacFindFont() // ATSUFontID and FMFont are equivalent FMFontStyle intrinsicStyle = 0 ; +#ifndef __LP64__ status = FMGetFontFromFontFamilyInstance( m_macFontFamily , m_macFontStyle , &m_macATSUFontID , &intrinsicStyle); wxASSERT_MSG( status == noErr , wxT("couldn't get an ATSUFont from font family") ); - +#endif m_macATSUAdditionalQDStyles = m_macFontStyle & (~intrinsicStyle ); if ( m_macATSUStyle ) @@ -515,6 +530,20 @@ int wxFont::GetPointSize() const return M_FONTDATA->m_pointSize; } +wxSize wxFont::GetPixelSize() const +{ +#if wxUSE_GRAPHICS_CONTEXT + // TODO: consider caching the value + wxGraphicsContext* dc = wxGraphicsContext::CreateFromNative((CGContextRef) NULL); + dc->SetFont(*(wxFont *)this,*wxBLACK); + wxDouble width, height = 0; + dc->GetTextExtent( wxT("g"), &width, &height, NULL, NULL); + return wxSize((int)width, (int)height); +#else + wxFontBase::GetPixelSize(); +#endif +} + int wxFont::GetFamily() const { wxCHECK_MSG( M_FONTDATA != NULL , 0, wxT("invalid font") );