+ m_macFontRef = CTFontCreateUIFontForLanguage( m_macUIFontType, 0.0, NULL );
+ wxMacCFStringHolder name( CTFontCopyFamilyName( m_macFontRef ) );
+ m_faceName = name.AsString();
+ }
+ else
+ {
+ if ( m_faceName.empty() )
+ {
+ switch ( m_family )
+ {
+ case wxSCRIPT :
+ case wxROMAN :
+ case wxDECORATIVE :
+ m_faceName = wxT("Times");
+ break ;
+
+ case wxSWISS :
+ m_faceName = wxT("Lucida Grande");
+ break ;
+
+ case wxMODERN :
+ case wxTELETYPE:
+ m_faceName = wxT("Monaco");
+ break ;
+
+ default:
+ m_faceName = wxT("Times");
+ break ;
+ }
+ }
+
+ wxMacCFStringHolder cf( m_faceName, wxLocale::GetSystemEncoding() );
+ m_macFontRef = CTFontCreateWithName( cf, m_pointSize, NULL);
+ }
+
+ if ( m_macATSUStyle )
+ {
+ ::ATSUDisposeStyle((ATSUStyle)m_macATSUStyle);
+ m_macATSUStyle = NULL ;
+ }
+
+ status = ::ATSUCreateStyle((ATSUStyle *)&m_macATSUStyle);
+ wxASSERT_MSG( status == noErr , wxT("couldn't create ATSU style") );
+
+ ATSUAttributeTag atsuTags[] =
+ {
+ kATSUSizeTag ,
+ kATSUVerticalCharacterTag,
+ kATSUQDBoldfaceTag ,
+ kATSUQDItalicTag ,
+ kATSUQDUnderlineTag ,
+ kATSUQDCondensedTag ,
+ kATSUQDExtendedTag ,
+ kATSUFontTag ,
+ };
+ ByteCount atsuSizes[sizeof(atsuTags) / sizeof(ATSUAttributeTag)] =
+ {
+ sizeof( Fixed ) ,
+ sizeof( ATSUVerticalCharacterType),
+ sizeof( Boolean ) ,
+ sizeof( Boolean ) ,
+ sizeof( Boolean ) ,
+ sizeof( Boolean ) ,
+ sizeof( Boolean ) ,
+ sizeof( ATSUFontID ) ,
+ };
+
+ Boolean kTrue = true ;
+ Boolean kFalse = false ;
+
+ Fixed atsuSize = IntToFixed( m_pointSize );
+ short m_macATSUAdditionalQDStyles = 0;
+ ATSUVerticalCharacterType kHorizontal = kATSUStronglyHorizontal;
+ ATSUFontID atsuFontID = 0;
+ int attributeCount = sizeof(atsuTags) / sizeof(ATSUAttributeTag) ;
+
+ // attempt to add atsu font
+#if 0
+ status = ATSUFindFontFromName(m_faceName.c_str(), strlen(m_faceName.c_str()), kFontFamilyName, kFontNoPlatform, kFontNoScript, kFontNoLanguage, &atsuFontID);
+ if ( status != noErr )
+ {
+ attributeCount--;
+ }
+#endif
+ ATSUAttributeValuePtr atsuValues[sizeof(atsuTags) / sizeof(ATSUAttributeTag)] =
+ {
+ &atsuSize ,
+ &kHorizontal,
+ (m_macATSUAdditionalQDStyles & bold) ? &kTrue : &kFalse ,
+ (m_macATSUAdditionalQDStyles & italic) ? &kTrue : &kFalse ,
+ (m_macATSUAdditionalQDStyles & underline) ? &kTrue : &kFalse ,
+ (m_macATSUAdditionalQDStyles & condense) ? &kTrue : &kFalse ,
+ (m_macATSUAdditionalQDStyles & extend) ? &kTrue : &kFalse ,
+ &atsuFontID ,
+ };
+
+ status = ::ATSUSetAttributes( (ATSUStyle)m_macATSUStyle, attributeCount, atsuTags, atsuSizes, atsuValues);
+
+ wxASSERT_MSG( status == noErr , wxT("couldn't modify ATSU style") );
+#else
+ if ( m_macThemeFontID != kThemeCurrentPortFont )
+ {
+ Style style ;
+ GetThemeFont( m_macThemeFontID, GetApplicationScript(), qdFontName, &m_macFontSize, &style );
+ m_macFontStyle = style ;
+ m_faceName = wxMacMakeStringFromPascal( qdFontName );