当我尝试使用 tvOS 下的任何字体实例化 SKLabelNode 时,我遇到了问题。我根据文档(here)使用以下内容:
SKLabelNode *label = [SKLabelNode labelNodeWithFontNamed:@"Chalkduster"];
但是,字体不会更改并使用默认字体。我错过了什么吗?
感谢您的帮助!
编辑:
显然有些iOS字体目前在tvOS上不可用。如果它帮助这里的任何人是目前可以使用的字体列表:
Kohinoor Telugu: (
"KohinoorTelugu-Light",
"KohinoorTelugu-Medium",
"KohinoorTelugu-Regular"
)
Heiti SC: (
)
Symbol: (
Symbol
)
Courier: (
"Courier-BoldOblique",
Courier,
"Courier-Bold",
"Courier-Oblique"
)
Avenir Next: (
"AvenirNext-DemiBold",
"AvenirNext-UltraLight",
"AvenirNext-Regular",
"AvenirNext-HeavyItalic",
"AvenirNext-BoldItalic",
"AvenirNext-MediumItalic",
"AvenirNext-Italic",
"AvenirNext-Heavy",
"AvenirNext-DemiBoldItalic",
"AvenirNext-Bold",
"AvenirNext-UltraLightItalic",
"AvenirNext-Medium"
)
Arial Hebrew: (
"ArialHebrew-Light",
ArialHebrew,
"ArialHebrew-Bold"
)
Telugu Sangam MN: (
)
Helvetica Neue: (
"HelveticaNeue-UltraLight",
"HelveticaNeue-UltraLightItalic",
"HelveticaNeue-LightItalic",
HelveticaNeue,
"HelveticaNeue-Light",
"HelveticaNeue-MediumItalic",
"HelveticaNeue-CondensedBold",
"HelveticaNeue-CondensedBlack",
"HelveticaNeue-Thin",
"HelveticaNeue-ThinItalic",
"HelveticaNeue-Medium",
"HelveticaNeue-Italic",
"HelveticaNeue-BoldItalic",
"HelveticaNeue-Bold"
)
Trebuchet MS: (
"TrebuchetMS-Italic",
"TrebuchetMS-Bold",
"Trebuchet-BoldItalic",
TrebuchetMS
)
Bangla Sangam MN: (
)
Heiti TC: (
)
Hiragino Sans: (
"HiraginoSans-W6",
"HiraginoSans-W3"
)
Tamil Sangam MN: (
TamilSangamMN,
"TamilSangamMN-Bold"
)
PingFang TC: (
"PingFangTC-Semibold",
"PingFangTC-Medium",
"PingFangTC-Regular",
"PingFangTC-Ultralight",
"PingFangTC-Light",
"PingFangTC-Thin"
)
Times New Roman: (
"TimesNewRomanPS-ItalicMT",
"TimesNewRomanPS-BoldItalicMT",
TimesNewRomanPSMT,
"TimesNewRomanPS-BoldMT"
)
Kohinoor Devanagari: (
"KohinoorDevanagari-Light",
"KohinoorDevanagari-Regular",
"KohinoorDevanagari-Semibold"
)
Kohinoor Bangla: (
"KohinoorBangla-Regular",
"KohinoorBangla-Semibold",
"KohinoorBangla-Light"
)
Thonburi: (
Thonburi,
"Thonburi-Bold",
"Thonburi-Light"
)
Gujarati Sangam MN: (
"GujaratiSangamMN-Bold",
GujaratiSangamMN
)
Geeza Pro: (
"GeezaPro-Bold",
GeezaPro
)
Lao Sangam MN: (
LaoSangamMN
)
Sinhala Sangam MN: (
"SinhalaSangamMN-Bold",
SinhalaSangamMN
)
Courier New: (
CourierNewPSMT,
"CourierNewPS-BoldItalicMT",
"CourierNewPS-BoldMT",
"CourierNewPS-ItalicMT"
)
Malayalam Sangam MN: (
MalayalamSangamMN,
"MalayalamSangamMN-Bold"
)
PingFang SC: (
"PingFangSC-Regular",
"PingFangSC-Ultralight",
"PingFangSC-Thin",
"PingFangSC-Medium",
"PingFangSC-Light",
"PingFangSC-Semibold"
)
Apple SD Gothic Neo: (
"AppleSDGothicNeo-Thin",
"AppleSDGothicNeo-SemiBold",
"AppleSDGothicNeo-Light",
"AppleSDGothicNeo-Medium",
"AppleSDGothicNeo-Bold",
"AppleSDGothicNeo-UltraLight",
"AppleSDGothicNeo-Regular"
)
Euphemia UCAS: (
EuphemiaUCAS,
"EuphemiaUCAS-Bold",
"EuphemiaUCAS-Italic"
)
PingFang HK: (
"PingFangHK-Regular",
"PingFangHK-Medium",
"PingFangHK-Thin",
"PingFangHK-Semibold",
"PingFangHK-Light",
"PingFangHK-Ultralight"
)
Menlo: (
"Menlo-BoldItalic",
"Menlo-Italic",
"Menlo-Regular",
"Menlo-Bold"
)
Kailasa: (
Kailasa,
"Kailasa-Bold"
)
Khmer Sangam MN: (
KhmerSangamMN
)
Avenir: (
"Avenir-Book",
"Avenir-Heavy",
"Avenir-BlackOblique",
"Avenir-Black",
"Avenir-LightOblique",
"Avenir-BookOblique",
"Avenir-Light",
"Avenir-Medium",
"Avenir-HeavyOblique",
"Avenir-Oblique",
"Avenir-Roman",
"Avenir-MediumOblique"
)
Savoye LET: (
SavoyeLetPlain
)
Zapf Dingbats: (
ZapfDingbatsITC
)
Kannada Sangam MN: (
"KannadaSangamMN-Bold",
KannadaSangamMN
)
Copperplate: (
Copperplate,
"Copperplate-Light",
"Copperplate-Bold"
)
Gurmukhi MN: (
GurmukhiMN,
"GurmukhiMN-Bold"
)
Iowan Old Style: (
"IowanOldStyle-Italic",
"IowanOldStyle-Bold",
"IowanOldStyle-BoldItalic",
"IowanOldStyle-Roman"
)
Oriya Sangam MN: (
"OriyaSangamMN-Bold",
OriyaSangamMN
)
Helvetica: (
"Helvetica-Oblique",
"Helvetica-Bold",
"Helvetica-LightOblique",
"Helvetica-BoldOblique",
"Helvetica-Light",
Helvetica
)
答案 0 :(得分:0)
使用以下代码段验证tvOS上Chalkduster
是否为正确的字体名称:
NSArray *fontFamilies = [UIFont familyNames];
for (int i = 0; i < [fontFamilies count]; i++)
{
NSString *fontFamily = [fontFamilies objectAtIndex:i];
NSArray *fontNames = [UIFont fontNamesForFamilyName:[fontFamilies objectAtIndex:i]];
NSLog (@"%@: %@", fontFamily, fontNames);
}