#if wxOSX_USE_CORE_TEXT
wxCFRef<CTFontRef> m_ctFont;
#endif
-#if wxOSX_USE_CORE_TEXT || wxOSX_USE_ATSU_TEXT
+#if wxOSX_USE_ATSU_TEXT
ATSUStyle m_macATSUStyle ;
#endif
+ wxCFRef<CGFontRef> m_cgFont;
#if wxOSX_USE_COCOA
WX_NSFont m_nsFont;
#endif
#endif
#if wxOSX_USE_CORE_TEXT
m_ctFont = data.m_ctFont;
-#endif
-#if wxOSX_USE_CORE_TEXT || wxOSX_USE_ATSU_TEXT
+#endif
+ m_cgFont = data.m_cgFont;
+#if wxOSX_USE_ATSU_TEXT
if ( data.m_macATSUStyle != NULL )
{
ATSUCreateStyle(&m_macATSUStyle) ;
m_nsFont = (NSFont*) wxMacCocoaRetain(data.m_nsFont);
#endif
#if wxOSX_USE_IPHONE
- m_uiFont = wxMacCocoaRetain(data.m_uiFont);
+ m_uiFont = (UIFont*) wxMacCocoaRetain(data.m_uiFont);
#endif
}
#if wxOSX_USE_CARBON && wxOSX_USE_ATSU_TEXT
m_macThemeFontID = kThemeCurrentPortFont ;
#endif
-#if wxOSX_USE_CORE_TEXT || wxOSX_USE_ATSU_TEXT
+#if wxOSX_USE_ATSU_TEXT
m_macATSUStyle = NULL ;
#endif
#if wxOSX_USE_COCOA
#if wxOSX_USE_CORE_TEXT
m_ctFont.reset();
#endif
-#if wxOSX_USE_CORE_TEXT || wxOSX_USE_ATSU_TEXT
+ m_cgFont.reset();
+#if wxOSX_USE_ATSU_TEXT
if ( m_macATSUStyle )
{
::ATSUDisposeStyle((ATSUStyle)m_macATSUStyle);
#if wxOSX_USE_CORE_TEXT
if ( UMAGetSystemVersion() >= 0x1050 )
{
- CTFontUIFontType uifont;
+ CTFontUIFontType uifont = kCTFontSystemFontType;
switch( font )
{
case wxOSX_SYSTEM_FONT_NORMAL:
{
#if !wxOSX_USE_CARBON
// not needed outside
- ThemeFontID m_macThemeFontID;
+ ThemeFontID m_macThemeFontID = kThemeSystemFont;
#endif
switch( font )
{
}
#endif
#if wxOSX_USE_COCOA
- m_nsFont = wxFont::CreateNSFont( font, &m_info );
+ m_nsFont = wxFont::OSXCreateNSFont( font, &m_info );
#endif
#if wxOSX_USE_IPHONE
- m_uiFont = wxFont::CreateUIFont( font, &m_info );
+ m_uiFont = wxFont::OSXCreateUIFont( font, &m_info );
#endif
}
{
m_ctFont.reset( CTFontCreateWithFontDescriptor( m_info.m_ctFontDescriptor, 0/*m_pointSize */, NULL ) );
}
+ m_cgFont.reset(CTFontCopyGraphicsFont(m_ctFont, NULL));
}
#endif
atsuTags, atsuSizes, atsuValues);
wxASSERT_MSG( status == noErr , wxT("couldn't modify ATSU style") );
- return;
+ if ( m_cgFont.get() == NULL )
+ {
+ ATSFontRef fontRef = FMGetATSFontRefFromFont(m_info.m_atsuFontID);
+ m_cgFont.reset( CGFontCreateWithPlatformFont( &fontRef ) );
+ }
}
#endif
#if wxOSX_USE_COCOA
- m_nsFont = wxFont::CreateNSFont( &m_info );
+ m_nsFont = wxFont::OSXCreateNSFont( &m_info );
#endif
#if wxOSX_USE_IPHONE
- m_uiFont = wxFont::CreateUIFont( &m_info );
+ m_uiFont = wxFont::OSXCreateUIFont( &m_info );
#endif
m_fontValid = true;
}
{
}
+void wxFont::DoSetNativeFontInfo(const wxNativeFontInfo& info)
+{
+ UnRef();
+
+ m_refData = new wxFontRefData( info);
+}
+
+
bool wxFont::RealizeResource()
{
M_FONTDATA->MacFindFont();
#endif
-#if wxOSX_USE_CORE_TEXT || wxOSX_USE_ATSU_TEXT
+#if wxOSX_USE_ATSU_TEXT
void * wxFont::MacGetATSUStyle() const
{
wxCHECK_MSG( M_FONTDATA != NULL , NULL, wxT("invalid font") );
return M_FONTDATA->m_macATSUStyle;
}
+
+#if WXWIN_COMPATIBILITY_2_8
+wxUint32 wxFont::MacGetATSUFontID() const
+{
+ wxCHECK_MSG( M_FONTDATA != NULL , NULL, wxT("invalid font") );
+
+ // cast away constness otherwise lazy font resolution is not possible
+ const_cast<wxFont *>(this)->RealizeResource();
+
+ return M_FONTDATA->m_info.m_atsuFontID;
+}
+
+wxUint32 wxFont::MacGetATSUAdditionalQDStyles() const
+{
+ wxCHECK_MSG( M_FONTDATA != NULL , NULL, wxT("invalid font") );
+
+ // cast away constness otherwise lazy font resolution is not possible
+ const_cast<wxFont *>(this)->RealizeResource();
+
+ return M_FONTDATA->m_info.m_atsuAdditionalQDStyles;
+}
+#endif
+
#endif
#if wxOSX_USE_CORE_TEXT
-CTFontRef wxFont::GetCTFont() const
+CTFontRef wxFont::OSXGetCTFont() const
{
wxCHECK_MSG( M_FONTDATA != NULL , 0, wxT("invalid font") );
#endif
+#if wxOSX_USE_COCOA_OR_CARBON
+
+CGFontRef wxFont::OSXGetCGFont() const
+{
+ wxCHECK_MSG( M_FONTDATA != NULL , 0, wxT("invalid font") );
+
+ // cast away constness otherwise lazy font resolution is not possible
+ const_cast<wxFont *>(this)->RealizeResource();
+
+ return (M_FONTDATA->m_cgFont);
+}
+
+#endif
+
+
#if wxOSX_USE_COCOA
-NSFont* wxFont::GetNSFont() const
+NSFont* wxFont::OSXGetNSFont() const
{
wxCHECK_MSG( M_FONTDATA != NULL , 0, wxT("invalid font") );
#endif
#if wxOSX_USE_COCOA
m_nsFontDescriptor = NULL;
-#endif
-#if wxOSX_USE_IPHONE
- m_uiFontDescriptor = NULL;
#endif
m_pointSize = 0;
m_family = wxFONTFAMILY_DEFAULT;
m_weight = wxFONTWEIGHT_NORMAL;
m_underlined = false;
m_faceName.clear();
- m_encoding = wxFONTENCODING_DEFAULT;
+ m_encoding = wxFont::GetDefaultEncoding();
m_descriptorValid = false;
}
#endif
#if wxOSX_USE_COCOA
if ( m_nsFontDescriptor == NULL )
- ValidateNSFontDescriptor();
+ OSXValidateNSFontDescriptor();
#endif
#if wxOSX_USE_IPHONE
// TODO
#endif
#if wxOSX_USE_COCOA
m_nsFontDescriptor = (NSFontDescriptor*) wxMacCocoaRetain(info.m_nsFontDescriptor);
-#endif
-#if wxOSX_USE_IPHONE
- m_uiFontDescriptor = wxMacCocoaRetain(info.m_uiFontDescriptor);;
#endif
m_pointSize = info.m_pointSize;
m_family = info.m_family;
m_weight = weight;
m_underlined = underlined;
m_faceName = faceName;
+ if ( encoding == wxFONTENCODING_DEFAULT )
+ encoding = wxFont::GetDefaultEncoding();
m_encoding = encoding;
}
#if wxOSX_USE_COCOA
wxMacCocoaRelease(m_nsFontDescriptor);
m_nsFontDescriptor = NULL;
-#endif
-#if wxOSX_USE_IPHONE
- wxMacCocoaRelease(m_uiFontDescriptor);
- m_uiFontDescriptor = NULL
#endif
m_descriptorValid = false;
}
void wxNativeFontInfo::SetEncoding(wxFontEncoding encoding_)
{
+ if ( encoding_ == wxFONTENCODING_DEFAULT )
+ encoding_ = wxFont::GetDefaultEncoding();
m_encoding = encoding_;
// not reflected in native descriptors
}
\ No newline at end of file