如何为自定义字体使用粗体,常规和斜体字体样式? [英] How to use bold, regular and italic font styles for custom fonts?
问题描述
我目前在我的应用程序中使用字体Yoxall,并有Regular,Bold和Italic的.ttf文件。我正在使用焦炭 [UIFont fontWithName:@Yoxallsize:20.0f]
将字体设置为常规Yoxall,使用YOXALL __。ttf文件文件。我也想在我的应用程序的其他地方使用斜体Yoxall,但我显然不能调用相同的方法,因为Yoxall是指这两个文件。
我会用什么代码来区分这种字体的常规,粗体和斜体样式?
NSLog(@%@,fontName);
这个函数会给出所有的字体名称。
I am currently using the font Yoxall in my app, and have .ttf files for "Regular", "Bold", and "Italic". I am currently using the coke [UIFont fontWithName:@"Yoxall" size:20.0f]
to set the font as the regular Yoxall, using the YOXALL__.ttf file in my supporting files. I would also like to use italic Yoxall elsewhere in my app, but I obviously cannot call the same method, as "Yoxall" refers to both these files.
What code would I use to distinguish between the regular, bold, and italic styles of this font?
for (NSString *familyName in [UIFont familyNames]) {
for (NSString *fontName in [UIFont fontNamesForFamilyName:familyName]){
NSLog(@"%@", fontName);
}
}
This function will give all fonts name.
这篇关于如何为自定义字体使用粗体,常规和斜体字体样式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!