]> git.saurik.com Git - wxWidgets.git/blobdiff - src/mac/carbon/fontdlg.cpp
removing non-compositing code, adding individual transparency
[wxWidgets.git] / src / mac / carbon / fontdlg.cpp
index 90ccac923947a4c00fa8ff286036f6b9ce760a67..85d6e518c1436a898089ff430614034d93bfbeb6 100644 (file)
@@ -39,7 +39,6 @@
 #endif
 
 #include "wx/fontdlg.h"
-#include "wx/dcclient.h"
 
 #if wxMAC_USE_EXPERIMENTAL_FONTDIALOG
 
@@ -68,14 +67,21 @@ pascal OSStatus wxMacCarbonFontPanelHandler(EventHandlerCallRef nextHandler, Eve
     {
         case kEventFontSelection :
         {
-            FMFont fontId = 0 ;
+            ATSUFontID fontId = 0 ;
             if ( cEvent.GetParameter<ATSUFontID>(kEventParamATSUFontID, &fontId) == noErr )
             {
                 FMFontStyle fontStyle = cEvent.GetParameter<FMFontStyle>(kEventParamFMFontStyle);
                 FMFontSize fontSize = cEvent.GetParameter<FMFontSize>(kEventParamFMFontSize);
 
-                ByteCount actualLength = 0;
                 CFStringRef cfName = NULL;
+#if 1
+                FMFontFamily fontFamily = cEvent.GetParameter<FMFontFamily>(kEventParamFMFontFamily);
+                ATSFontFamilyRef atsfontfamilyref = FMGetATSFontFamilyRefFromFontFamily( fontFamily ) ;
+                OSStatus err = ATSFontFamilyGetName( atsfontfamilyref , kATSOptionFlagsDefault , &cfName ) ;
+                wxASSERT_MSG( err == noErr , wxT("ATSFontFamilyGetName failed") );
+#else
+                // we don't use the ATSU naming anymore
+                ByteCount actualLength = 0;
                 char *c = NULL;
                 OSStatus err = ATSUFindFontName(fontId , kFontFamilyName, kFontUnicodePlatform, kFontNoScriptCode,
                     kFontNoLanguageCode , 0 , NULL , &actualLength , NULL );
@@ -103,14 +109,15 @@ pascal OSStatus wxMacCarbonFontPanelHandler(EventHandlerCallRef nextHandler, Eve
                 }
                 if ( c!=NULL )
                     free(c);
-
+#endif
+                 
                 if ( cfName!=NULL )
                 {
                     fontdata.m_chosenFont.SetFaceName(wxMacCFStringHolder(cfName).AsString(wxLocale::GetSystemEncoding()));
                     fontdata.m_chosenFont.SetPointSize(fontSize);
-                    fontdata.m_chosenFont.SetStyle(fontStyle & italic ? wxFONTSTYLE_ITALIC : 0);
-                    fontdata.m_chosenFont.SetUnderlined(fontStyle & underline ? wxFONTSTYLE_ITALIC : 0);
-                    fontdata.m_chosenFont.SetWeight(fontStyle & bold ? wxBOLD : wxNORMAL);
+                    fontdata.m_chosenFont.SetStyle(fontStyle & italic ? wxFONTSTYLE_ITALIC : wxFONTSTYLE_NORMAL);
+                    fontdata.m_chosenFont.SetUnderlined((fontStyle & underline)!=0);
+                    fontdata.m_chosenFont.SetWeight(fontStyle & bold ? wxFONTWEIGHT_BOLD : wxFONTWEIGHT_NORMAL);
                 }
             }