斜体字体不适用于XCode [英] Italic Font Is Not Working on XCode
问题描述
我已将我的ttf字体(ABeeZee-Italic.ttf)从Google WebFonts复制到Supporting Files中并添加到plist中:
I have copy my ttf font (ABeeZee-Italic.ttf) from Google WebFonts into Supporting Files and added into plist :
并为我的标签分配标签= 4:
and assign my Label with tag = 4 :
因为我有这段代码将字体嵌入到UILabel中:
because I have this code to embed fonts into UILabel:
for (UILabel *customLabel in [[self view] subviews]) {
if (customLabel.tag == 1) {
[customLabel setFont:[UIFont fontWithName:@"Raleway-ExtraLight" size:21]];
} else if (customLabel.tag==2){
[customLabel setFont:[UIFont fontWithName:@"ABeeZee-Regular" size:14]];
} else if (customLabel.tag==3){
[customLabel setFont:[UIFont fontWithName:@"ABeeZee-Regular" size:11]];
} else if (customLabel.tag==4){
[customLabel setFont:[UIFont fontWithName:@"ABeeZee-Italic" size:12]];
}
}
所有功能都像超级按钮一样工作,但斜体字体未加载到我的iPod(iOS 6.1.3)中.带有标签4的UILabel是iOS系统字体.不是ABeeZee-Italic.
it's all working like a charm, but the italic font is not loaded into my iPod (iOS 6.1.3). UILabel with tag 4 is the iOS system font. not ABeeZee-Italic.
我试图更改标签号,但也失败了.对于将非常规字体嵌入到iOS中有什么具体要求?
I tried to change the tag number, but also failed. Is there any specific requirements for non-regular font to be embedded into iOS?
谢谢
更新@iPatel答案:这是我的FontBook的样子,它具有相同的名称...
UPDATE @iPatel answer : here's how my FontBook looks like, it has same name...
推荐答案
您可以通过两种方式执行此操作.
You can do this in two ways.
使用ttf文件
[customLabel setFont:[UIFont fontWithName:@"Raleway-ExtraLight.ttf" size:21]];
或
使用字体名称
[customLabel setFont:[UIFont fontWithName:<Name of Raleway-ExtraLight> size:21]];
在您的情况下,只需在setFont:
中添加 .ttf ,否则将获得字体名称,如下图所示.
In your case just add .ttf in setFont:
else get Name of font as shown in below image.
只需右键单击.ttf文件>获取信息>全名(您的字体名称.您可以在setFont中将此名称用作字体名称)
Just right click on .ttf file > Get Info > Full Name (your font name. You can use this name as font name in setFont)
编辑
在此处检查全名并将其粘贴到您的代码中.
Check the full name here and paste it in your code.
[customLabel setFont:[UIFont fontWithName:@"ABeeZee Italic" size:21]];
编辑1
可能您需要注册字体 .只需尝试注册并检查.
May be you need to Register Fonts. Just try to register and check.
这篇关于斜体字体不适用于XCode的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!