- if( m_faceName == "" )
- {
- switch( m_family )
- {
- case wxDEFAULT :
- m_macFontNum = ::GetAppFont() ;
- break ;
- case wxDECORATIVE :
- ::GetFNum( "\pTimes" , &m_macFontNum) ;
- break ;
- case wxROMAN :
- ::GetFNum( "\pTimes" , &m_macFontNum) ;
- break ;
- case wxSCRIPT :
- ::GetFNum( "\pTimes" , &m_macFontNum) ;
- break ;
- case wxSWISS :
- ::GetFNum( "\pGeneva" , &m_macFontNum) ;
- break ;
- case wxMODERN :
- ::GetFNum( "\pMonaco" , &m_macFontNum) ;
- break ;
- }
- }
- else
- {
- if ( m_faceName == "systemfont" )
- m_macFontNum = ::GetSysFont() ;
- else if ( m_faceName == "applicationfont" )
- m_macFontNum = ::GetAppFont() ;
- else
- {
-#if TARGET_CARBON
- c2pstrcpy( (StringPtr) wxBuffer, m_faceName ) ;
-#else
- strcpy( (char *) wxBuffer, m_faceName ) ;
- c2pstr( (char *) wxBuffer ) ;
-#endif
- ::GetFNum( (StringPtr) wxBuffer, &m_macFontNum);
- }
- }
-
- m_macFontStyle = 0;
- if (m_weight == wxBOLD)
- m_macFontStyle |= bold;
- if (m_style == wxITALIC || m_style == wxSLANT)
- m_macFontStyle |= italic;
- if (m_underlined)
- m_macFontStyle |= underline;
- m_macFontSize = m_pointSize ;
+ if( m_faceName.Length() == 0 )
+ {
+ switch( m_family )
+ {
+ case wxDEFAULT :
+ m_macFontNum = ::GetAppFont() ;
+ break ;
+ case wxDECORATIVE :
+ ::GetFNum( "\pTimes" , &m_macFontNum) ;
+ break ;
+ case wxROMAN :
+ ::GetFNum( "\pTimes" , &m_macFontNum) ;
+ break ;
+ case wxSCRIPT :
+ ::GetFNum( "\pTimes" , &m_macFontNum) ;
+ break ;
+ case wxSWISS :
+ ::GetFNum( "\pGeneva" , &m_macFontNum) ;
+ break ;
+ case wxMODERN :
+ ::GetFNum( "\pMonaco" , &m_macFontNum) ;
+ break ;
+ }
+ Str255 name ;
+ GetFontName( m_macFontNum , name ) ;
+ m_faceName = wxMacMakeStringFromPascal( name ) ;
+ }
+ else
+ {
+ if ( m_faceName == wxT("systemfont") )
+ m_macFontNum = ::GetSysFont() ;
+ else if ( m_faceName == wxT("applicationfont") )
+ m_macFontNum = ::GetAppFont() ;
+ else
+ {
+ Str255 fontname ;
+ wxMacStringToPascal( m_faceName , fontname ) ;
+ ::GetFNum( fontname, &m_macFontNum);
+ }
+ }
+
+ m_macFontStyle = 0;
+ if (m_weight == wxBOLD)
+ m_macFontStyle |= bold;
+ if (m_style == wxITALIC || m_style == wxSLANT)
+ m_macFontStyle |= italic;
+ 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);
+ /*
+ status = ATSUFindFontFromName ( (Ptr) m_faceName , strlen( m_faceName ) ,
+ kFontFullName, kFontMacintoshPlatform, kFontRomanScript , kFontNoLanguage , (UInt32*)&m_macATSUFontID ) ;
+ */
+ wxASSERT_MSG( status == noErr , wxT("couldn't retrieve font identifier") ) ;