]> git.saurik.com Git - wxWidgets.git/blobdiff - src/mac/carbon/font.cpp
Hack to support iso8859 and other wrongly formated
[wxWidgets.git] / src / mac / carbon / font.cpp
index c95a5e8bdfed1c0bd667f4b22e9d13a09b6b429e..98ce6d7bbdbe7bf40b395cd901abff6fe9855fed 100644 (file)
@@ -18,6 +18,7 @@
     #include "wx/utils.h"
     #include "wx/intl.h"
     #include "wx/gdicmn.h"
+    #include "wx/log.h"
 #endif
 
 #include "wx/fontutil.h"
@@ -154,7 +155,7 @@ public:
     wxNativeFontInfo  m_info;
 };
 
-#define M_FONTDATA (wxFontRefData*)m_refData)
+#define M_FONTDATA ((wxFontRefData*)m_refData)
 
 
 // ============================================================================
@@ -263,6 +264,11 @@ void wxFontRefData::MacFindFont()
 #ifndef __LP64__
                 wxMacStringToPascal( m_faceName , qdFontName );
                 m_macFontFamily = FMGetFontFamilyFromName( qdFontName );
+                if ( m_macFontFamily == kInvalidFontFamily )
+                {
+                    wxLogDebug( wxT("ATSFontFamilyFindFromName failed for %s"), m_faceName );
+                    m_macFontFamily = GetAppFont();
+                }
 #endif
             }
         }
@@ -283,8 +289,13 @@ void wxFontRefData::MacFindFont()
             {
                 wxMacCFStringHolder cf( m_faceName, wxLocale::GetSystemEncoding() );
                 ATSFontFamilyRef atsfamily = ATSFontFamilyFindFromName( cf , kATSOptionFlagsDefault );
-                wxASSERT_MSG( atsfamily != (ATSFontFamilyRef) -1 , wxT("ATSFontFamilyFindFromName failed") );
-                m_macFontFamily = FMGetFontFamilyFromATSFontFamilyRef( atsfamily );
+                if ( atsfamily == (ATSFontFamilyRef) -1 )
+                {
+                    wxLogDebug( wxT("ATSFontFamilyFindFromName failed for %s"), m_faceName );
+                    m_macFontFamily = GetAppFont();
+                }
+                else
+                    m_macFontFamily = FMGetFontFamilyFromATSFontFamilyRef( atsfamily );
             }
         }