gpt4 book ai didi

cocoa - 如何在 Cocoa 应用程序中使用斜体 LucidaGrande 字体

转载 作者:行者123 更新时间:2023-12-03 17:26:11 25 4
gpt4 key购买 nike

最近我正在为我的应用程序进行从 Carbon 到 Cocoa 的转换。

我的App使用的字体是“LucidaGrande”,我是通过这个方法得到的:

myUIFont = [NSFont systemFontOfSize: [NSFont systemFontSize]];

有时我的应用程序希望在其 UI 中显示斜体样式字体,所以我称之为:

myUIFont = [[NSFontManager sharedFontManager] convertFont:myUIFont toHaveTrait:NSItalicFontMask];

但是这次转换失败了。我发现这是因为“LucidaGrande”字体没有斜体样式。我可以通过调用来验证这一点:

NSArray* availableNames = [[NSFontManager sharedFontManager] availableFontNamesWithTraits:NSItalicFontMask];

availableNames 中没有“LucidaGrande”。这很好奇,因为我可以在我的 Carbon 应用程序中使用斜体“LucidaGrande”字体。有什么解决方案可以为 Cocoa App 提供斜体“LucidaGrande”字体吗?或者我怎样才能得到类似的斜体?

非常感谢!

最佳答案

Lucida Grande 本身没有斜体版本。复写文本 API 通过倾斜常规版本来伪造它。 Lucida Sans 和 Lucida Sans Unicode(常规)的拉丁文子集相同,并且有斜体版本,但不随操作系统一起提供。

关于cocoa - 如何在 Cocoa 应用程序中使用斜体 LucidaGrande 字体,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4458983/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com