From 67c4b73f9b448490538959533b5dade195f9ab8b Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 12 Oct 2009 17:30:35 +0000 Subject: [PATCH] Use Cocoa methods instead of wx ones in wxDVC font setting code. Use NSFontManager to create bold or italic version of the font instead of using wxFont. This works better for the bold attribute, but setting the italic one still doesn't do anything. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62388 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/osx/cocoa/dataview.mm | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/src/osx/cocoa/dataview.mm b/src/osx/cocoa/dataview.mm index 224c89c53f..4693000067 100644 --- a/src/osx/cocoa/dataview.mm +++ b/src/osx/cocoa/dataview.mm @@ -1525,12 +1525,19 @@ wxWidgetImplType* CreateDataView(wxWindowMac* wxpeer, wxWindowMac* WXUNUSED(pare { if ( attr.HasFont() ) { - wxFont font(dvc->GetFont()); - if ( attr.GetBold() ) - font.MakeBold(); - if ( attr.GetItalic() ) - font.MakeItalic(); - [cell setFont:font.OSXGetNSFont()]; + // FIXME: using wxFont methods here doesn't work for some reason + NSFontManager * const fm = [NSFontManager sharedFontManager]; + NSFont *font = [cell font]; + if ( font ) + { + if ( attr.GetBold() ) + font = [fm convertFont:font toHaveTrait:NSBoldFontMask]; + if ( attr.GetItalic() ) + font = [fm convertFont:font toHaveTrait:NSItalicFontMask]; + + [cell setFont:font]; + } + //else: can't change font if the cell doesn't have any } // we can set font for any cell but only NSTextFieldCell provides a -- 2.50.0