X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/ed4b0fdca60e017afe72c55940799ce0fed925f0..a3ab1c18017bb08329e73918f9f502ea00cdb447:/src/mac/carbon/fontdlg.cpp diff --git a/src/mac/carbon/fontdlg.cpp b/src/mac/carbon/fontdlg.cpp index 3fab91215e..67b93fb6cb 100644 --- a/src/mac/carbon/fontdlg.cpp +++ b/src/mac/carbon/fontdlg.cpp @@ -20,6 +20,8 @@ // For compilers that support precompilation, includes "wx.h". #include "wx/wxprec.h" +#if wxUSE_FONTDLG + #ifdef __BORLANDC__ #pragma hdrstop #endif @@ -67,14 +69,21 @@ pascal OSStatus wxMacCarbonFontPanelHandler(EventHandlerCallRef nextHandler, Eve { case kEventFontSelection : { - FMFont fontId = 0 ; + ATSUFontID fontId = 0 ; if ( cEvent.GetParameter(kEventParamATSUFontID, &fontId) == noErr ) { FMFontStyle fontStyle = cEvent.GetParameter(kEventParamFMFontStyle); FMFontSize fontSize = cEvent.GetParameter(kEventParamFMFontSize); - ByteCount actualLength = 0; CFStringRef cfName = NULL; +#if 1 + FMFontFamily fontFamily = cEvent.GetParameter(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 ); @@ -102,14 +111,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); } } @@ -278,7 +288,7 @@ class wxFontColourSwatchCtrl: public wxControl DECLARE_CLASS(wxFontColourSwatchCtrl) public: wxFontColourSwatchCtrl(wxWindow* parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = 0); - ~wxFontColourSwatchCtrl(); + virtual ~wxFontColourSwatchCtrl(); void OnPaint(wxPaintEvent& event); void OnMouseEvent(wxMouseEvent& event); @@ -527,18 +537,18 @@ void wxFontDialog::CreateControls() wxFontEnumerator enumerator; enumerator.EnumerateFacenames(); - wxArrayString* facenames = enumerator.GetFacenames(); + wxArrayString facenames = enumerator.GetFacenames(); if (facenames) { - facenames->Add(_("")); - facenames->Add(_("")); - facenames->Add(_("")); - facenames->Add(_("")); - facenames->Add(_("")); - facenames->Add(_("")); - facenames->Add(_("")); - facenames->Sort(); - m_facenameCtrl->Append(*facenames); + facenames.Add(_("")); + facenames.Add(_("")); + facenames.Add(_("")); + facenames.Add(_("")); + facenames.Add(_("")); + facenames.Add(_("")); + facenames.Add(_("")); + facenames.Sort(); + m_facenameCtrl->Append(facenames); } InitializeControls(); @@ -774,4 +784,6 @@ int FontFamilyStringToInt(const wxChar *family) #endif // !USE_NATIVE_FONT_DIALOG_FOR_MACOSX -#endif +#endif // wxMAC_USE_EXPERIMENTAL_FONTDIALOG + +#endif // wxUSE_FONTDLG