X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/01548e7c0212a36eadf52d6b3cd35bd4c68004cd..c9ed413ab4f5673ffff00198dc6ce1397398bda4:/src/osx/carbon/fontdlg.cpp diff --git a/src/osx/carbon/fontdlg.cpp b/src/osx/carbon/fontdlg.cpp index 221f769ed8..cf0aed1759 100644 --- a/src/osx/carbon/fontdlg.cpp +++ b/src/osx/carbon/fontdlg.cpp @@ -41,6 +41,7 @@ #endif #include "wx/fontdlg.h" +#include "wx/fontutil.h" #if wxOSX_USE_EXPERIMENTAL_FONTDIALOG @@ -82,7 +83,9 @@ wxMacCarbonFontPanelHandler(EventHandlerCallRef WXUNUSED(nextHandler), if ( cEvent.GetParameter( kEventParamCTFontDescriptor, typeCTFontDescriptorRef, &descr ) == noErr ) { wxFont font; - font.MacCreateFromCTFontDescriptor(descr); + wxNativeFontInfo fontinfo; + fontinfo.Init(descr); + font.Create(fontinfo); fontdata.SetChosenFont( font ) ; setup = true; } @@ -100,7 +103,7 @@ wxMacCarbonFontPanelHandler(EventHandlerCallRef WXUNUSED(nextHandler), FMFontFamily fontFamily = cEvent.GetParameter(kEventParamFMFontFamily); ATSFontFamilyRef atsfontfamilyref = FMGetATSFontFamilyRefFromFontFamily( fontFamily ) ; OSStatus err = ATSFontFamilyGetName( atsfontfamilyref , kATSOptionFlagsDefault , &cfName ) ; - if ( err == noErr ) + if ( err != noErr ) { wxFAIL_MSG("ATSFontFamilyGetName failed"); } @@ -229,7 +232,7 @@ int wxFontDialog::ShowModal() #if wxOSX_USE_CORE_TEXT if ( UMAGetSystemVersion() >= 0x1050 ) { - CTFontDescriptorRef descr = (CTFontDescriptorRef) CTFontCopyFontDescriptor( (CTFontRef) font.MacGetCTFont() ); + CTFontDescriptorRef descr = (CTFontDescriptorRef) CTFontCopyFontDescriptor( (CTFontRef) font.OSXGetCTFont() ); err = SetFontInfoForSelection (kFontSelectionCoreTextType,1, &descr , NULL); CFRelease( descr ); setup = true; @@ -254,8 +257,9 @@ int wxFontDialog::ShowModal() if ( !FPIsFontPanelVisible() ) FPShowHideFontPanel(); #endif + wxDialog::OSXBeginModalDialog(); int retval = RunMixedFontDialog(this); - + wxDialog::OSXEndModalDialog(); #if wxOSX_USE_CARBON ::RemoveEventHandler(handler); #endif @@ -509,7 +513,7 @@ void wxFontDialog::CreateControls() wxStaticText* itemStaticText8 = new wxStaticText( itemDialog1, wxID_STATIC, _("Size:"), wxDefaultPosition, wxDefaultSize, 0 ); itemFlexGridSizer4->Add(itemStaticText8, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL, 5); - m_sizeCtrl = new wxSpinCtrl( itemDialog1, wxID_FONTDIALOG_FONTSIZE, _T("12"), wxDefaultPosition, wxSize(60, -1), wxSP_ARROW_KEYS, 1, 300, 12 ); + m_sizeCtrl = new wxSpinCtrl( itemDialog1, wxID_FONTDIALOG_FONTSIZE, wxT("12"), wxDefaultPosition, wxSize(60, -1), wxSP_ARROW_KEYS, 1, 300, 12 ); m_sizeCtrl->SetHelpText(_("The font size in points.")); if (ShowToolTips()) m_sizeCtrl->SetToolTip(_("The font size in points.")); @@ -585,7 +589,7 @@ void wxFontDialog::CreateControls() wxFontEnumerator enumerator; enumerator.EnumerateFacenames(); wxArrayString facenames = enumerator.GetFacenames(); - if (facenames) + if (!facenames.empty()) { facenames.Add(_("")); facenames.Add(_(""));