1

I am trying to add a custom font in my app, searched the web, there are many posts but i am getting error

InfoPlist.strings:0: error: validation failed: The data couldn’t be read because it has been corrupted. 

i dont get what's the issue, i added a new file of font in my project and added this code in plist, i never used plist before

<key>UIAppFonts</key> <array> <string>CloisterBlack.ttf </string> </array> 
2
  • Accept anyone answer because you have solved your issue. :) Commented Sep 19, 2012 at 9:44
  • sorry i thought i checked ur answer coz u helped a lot Commented Sep 19, 2012 at 9:50

4 Answers 4

4

Add font in plist, then check the name of your font, by double clicking the font file in finder, like in my case the name of the font is Abduction for the font file name "CloisterBlack.ttf"

then access it like

[UIFont fontWithName:@"Abduction" size:20.0]; 
Sign up to request clarification or add additional context in comments.

1 Comment

thanks, took one day then find a post that font name is not the file name !!!! duh. but worked finally
2

I think your font file has been corrupted. Add it again and then try. This link will help you Add Custom Font in your app. Make sure your file should be .ttf . Do you have any .ttf file or not ? If YES then add it to you project folder and then make little changes in your info.plist file.

enter image description here

If you dont have any .ttf file then download it first. It is your font file.

5 Comments

i did the same , actually used this tutorial , i dont know may be the font file, i downloaded from 1001fonts, hmm i try to add some font from other web
You will have download CloisterBlack.ttf file then drag it in to your project folder .... and then update it in to your plist like above image.
i just added my font same as in picture , but still not able to access it with [UIFont fontWithName:@"CloisterBlack" size:20.0]; tell me the things i should check on
Have you dragged CloisterBlack.ttf file in your project ?
we have to find the name of the font, file name is not the font name , check i answered my own question
1

I think adding the extension will fix it, my plist files look the same.

<key>UIAppFonts</key> <array> <string>CloisterBlack.ttf</string> </array> 

2 Comments

sorry not typed here, but i did type with extension, i edited my question
I believe the name used in the font file has to be the same as the name of the font file.
1

just use this class for custome fonts

5 Comments

Just create FontLabel object with font name. add font into project budle. FontLabel *label = [[FontLabel alloc] initWithFrame:CGRectMake(10, 10, 0, 0) fontName:@"Paint Boy" pointSize:40.0f]; label.textColor = [UIColor magentaColor]; label.text = @"lorem ipsum"; [label sizeToFit]; label.backgroundColor = nil; label.opaque = NO; [self.view addSubview:label];
had many error of ARC, after removing those again had errors other than ARC, will try tomorrow morning, is there any other way
oky if you are using ARC, then just go to Edit->Refactor->Convert To Objective-C ARC. ARC will be enable in this all classes.
getting errors in readTable NSCAssert1(cmapTable != NULL, @"CGFontCopyTableForTag returned NULL for 'cmap' tag in font %@", (font ? [(id)CFCopyDescription(font) autorelease] : @"(null)")); Cast of C pointer type 'CFStringRef' (aka 'const struct __CFString *') to Objective-C pointer type 'id' requires a bridged cast
hi, i have use this in MRC and code is also for MRC. its hard to convert into ARC. so you just need to disable ARC in FontLabel files.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.