Pages

Showing posts with label font. Show all posts
Showing posts with label font. Show all posts

Wednesday, October 9, 2013

Font Family Check in Xcode



NSArray *familyNames = [[NSArray alloc] initWithArray:[UIFont familyNames]];
NSArray *fontNames;
NSInteger indFamily, indFont;
for (indFamily=0; indFamily<[familyNames count]; ++indFamily)
{
    NSLog(@”Family name: %@”, [familyNames objectAtIndex:indFamily]);
    fontNames = [[NSArray alloc] initWithArray:
                 [UIFont fontNamesForFamilyName:
                  [familyNames objectAtIndex:indFamily]]];
    for (indFont=0; indFont<[fontNames count]; ++indFont)
    {
        NSLog(@” Font name: %@”, [fontNames objectAtIndex:indFont]);
    }
    [fontNames release];

}


Wednesday, September 4, 2013

Embed Font in Objective C


Here are the Steps to embed font in Objective C

Step 1 -

Put font file inside project file and add that font in project, like in attached top Image - marked with Red square

Step 2 -

Add font in ProjectName-info.plist
By Adding "Fonts provided by application" in item 0 add the name as "FontFileName".

Step 3 -

Add following code inside some comman place of project.

#define BebasNeueFont(_size_)\
[UIFont fontWithName:@"BebasNeue" size:_size_]

Step 4 -

Now Apply font to the label or required place as follow

self.embededFont.font = BebasNeueFont(21);

Result will be shown as below