UIFont Custom Style Setting

Myaaoonn

I am having a font name: HelveticaNeueLTStd-Roman 55.otf. I added it in my info.plist file.

When I write code :

UIFont *fontHalvetikaNeueLTStd = [UIFont fontWithName:@"Helvetica Neue LT Std" size:55];

It works Fyn!

But when I added following Code with Font style, it returns me nil.

UIFont *fontHalvetikaNeueLTStd = [UIFont fontWithName:@"Helvetica Neue LT Std 55 Roman" size:55];

How can I set "Roman 55" style in my Custom Font?

Solved By Adding Following:

Verify Font name By:

NSLog (@"Font families: %@", [UIFont fontNamesForFamilyName:@"Helvetica Neue LT Std"]);

Output:

Font families: (

"HelveticaNeueLTStd-Lt",
"HelveticaNeueLTStd-Roman"

)

Then Set By:

UIFont *fontHalvetikaNeueLTStd = [UIFont fontWithName:@"HelveticaNeueLTStd-Roman" size:size];

Thanks to all your hints.

Buntylm

Every time when we add custom fonts in our application need to review first about the font name and font full name. please review.

if yes then review font with the name Helvetica Neue LT Std 55 Roman exist in your system or not.

  • Use font file name in plist, and font name in your iOS code.

If you want to know all the load fonts in your app review this code.

for (NSString* family in [UIFont familyNames])   {
    NSLog(@"Font Family = %@", family);
    for (NSString* name in [UIFont fontNamesForFamilyName: family])   {
        NSLog(@"Font Name = %@", name);
    }
}

enter image description here

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related