如何在 objective c 中使用阿拉伯语自定义字体
How to use Arabic Custom Fonts in objective c
如何在我的工作 ios 应用程序中使用 A Jannat LT Arabic 字体。我在 xcode 8 中使用 objective c。我需要在整个过程中使用这些字体myProject 以及我从哪里获得 (.ttf) 文件? .我搜索了很多但找不到合适的答案,请帮助我解决这个问题。
我的问题是你需要字体还是需要实现它的方法
I think this is a nice explanation on how to add a custom font
如果你需要字体本身let me google it for you
更新
文件名并不总是与字体 family/font 名称一致,为了检查您的代码中有哪些字体系列,您可以使用
Swift3
for family: String in UIFont.familyNames {
print("\(family)")
for names: String in UIFont.fontNames(forFamilyName: family) {
print("== \(names)")
}
}
Obj-C
for (NSString* family in [UIFont familyNames]) {
NSLog(@"%@", family);
for (NSString* name in [UIFont fontNamesForFamilyName: family]) {
NSLog(@" %@", name);
}
}
请使用我给你的 link 来检查它是否按预期工作
按照这些步骤操作
1.) 将字体拖到您的项目中。
2.) 在 plist 中定义字体名称。打开 plist > 右键单击 > 添加行 > 键入:Fonts provided by application
> 按 + > yourFontName.ttf.
It look like this in info plist
Fonts provided by application : Array : (2 items)
item 0 : fontNameOne.ttf
item 1 : fontNameTwo.ttf
3.) 您可以从情节提要中检查它,也可以通过编程方式进行检查。
yourLabel.font=[UIFont fontWithName:@"yourFont" size:16.0f];//do not use .ttf here
如何在我的工作 ios 应用程序中使用 A Jannat LT Arabic 字体。我在 xcode 8 中使用 objective c。我需要在整个过程中使用这些字体myProject 以及我从哪里获得 (.ttf) 文件? .我搜索了很多但找不到合适的答案,请帮助我解决这个问题。
我的问题是你需要字体还是需要实现它的方法 I think this is a nice explanation on how to add a custom font
如果你需要字体本身let me google it for you
更新
文件名并不总是与字体 family/font 名称一致,为了检查您的代码中有哪些字体系列,您可以使用
Swift3
for family: String in UIFont.familyNames {
print("\(family)")
for names: String in UIFont.fontNames(forFamilyName: family) {
print("== \(names)")
}
}
Obj-C
for (NSString* family in [UIFont familyNames]) {
NSLog(@"%@", family);
for (NSString* name in [UIFont fontNamesForFamilyName: family]) {
NSLog(@" %@", name);
}
}
请使用我给你的 link 来检查它是否按预期工作
按照这些步骤操作
1.) 将字体拖到您的项目中。
2.) 在 plist 中定义字体名称。打开 plist > 右键单击 > 添加行 > 键入:Fonts provided by application
> 按 + > yourFontName.ttf.
It look like this in info plist
Fonts provided by application : Array : (2 items)
item 0 : fontNameOne.ttf
item 1 : fontNameTwo.ttf
3.) 您可以从情节提要中检查它,也可以通过编程方式进行检查。
yourLabel.font=[UIFont fontWithName:@"yourFont" size:16.0f];//do not use .ttf here