Recently I'm working on Carbon to Cocoa transition for my App.
The font my App used is "LucidaGrande", I got it from this method:
myUIFont = [NSFont systemFontOfSize: [NSFont systemFontSize]];
Sometimes my app want to show italic style font开发者_如何学Python in its UI, so I call this:
myUIFont = [[NSFontManager sharedFontManager] convertFont:myUIFont toHaveTrait:NSItalicFontMask];
But this conversion failed. I found that it's because that there is no italic style for "LucidaGrande" font. I can verify this by calling:
NSArray* availableNames = [[NSFontManager sharedFontManager] availableFontNamesWithTraits:NSItalicFontMask];
There's no "LucidaGrande" in availableNames. It is very curious because I can use italic "LucidaGrande" font in my Carbon App. Is there any solution to get a italic "LucidaGrande" font for Cocoa App? Or how can I get a similar italic one?
Thanks very much!
There is no italic version of Lucida Grande per se. Carbon text APIs fake it by slanting the regular version. Lucida Sans and Lucida Sans Unicode (regular) are identical in their Latin subsets, and have italic versions, but do not ship with the OS.
精彩评论