1

EveryBody i am trying to use custom font such as wingding in my ios application i have followed all those steps for adding custom font like adding the custom font file in my application resource and added the key fontsprovidedbytheapplication in plist and make it as array and below i have mentioned my custom font file name but, still those(wingding) are not working .when i try with other custom fonts they are working properly.

This is the code i have used so offer

   - (void)viewDidLoad
{
mine = [[UILabel alloc] initWithFrame:CGRectMake(10, 30, 240, 40)];

[mine setFont:[UIFont fontWithName:@"wingding" size:20]];

[mine setText:@"Where i am doing wrong"];

[self.view addSubview:mine];

[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
}

where i am missing ant suggestion will be a great help.

Ghouse
  • 516
  • 1
  • 8
  • 29
  • It's "Wingdings", not "wingding". – Cyrille Jun 20 '12 at 12:11
  • @Cyrille yes spelling mistake but in program it is proper and Wingdings are supported in ios? – Ghouse Jun 20 '12 at 12:25
  • Every TTF is supported as long as it's a valid font file. Be it Wingdings, Tahoma, or whatever font you find anywhere. As said in one of the answers, check in `[UIFont familyNames]` that your custom TTF is correctly registered. – Cyrille Jun 20 '12 at 13:24

3 Answers3

0

Try importing the font properly in the application using File > Add Files to "Your project name".. Not by just dragging and dropping the font.

This should solve your problem.

Pang
  • 9,564
  • 146
  • 81
  • 122
Ronak
  • 974
  • 6
  • 14
  • i have added my files properly – Ghouse Jun 20 '12 at 12:37
  • Get the list of fonts available using NSArray *familyNames = [UIFont familyNames]; and then get the actual name for the font you have installed. – Ronak Jun 20 '12 at 12:45
  • just now i have tried that one Wingdings is not mention .so most probably it should not be supported – Ghouse Jun 20 '12 at 12:47
  • If it is not mentioned it is not included properly i have tried at my side its working fine. try including the font as i said and NSLog(@"%@",familyNames); to get the list. It might be the case font name gets changed ,check properly – Ronak Jun 20 '12 at 12:48
  • i tried when i install and run the code it is showing in the console but my text is not getting changed and you said Wingdings is working in your code? – Ghouse Jun 20 '12 at 13:04
  • Check spelling ,copy the font name from the GDB console and use that font with correct spelling. Yes it working at my end – Ronak Jun 20 '12 at 13:46
  • i have tried every thing but still it didn't work could you please show your code .so that i can know what i am doing wrong – Ghouse Jun 21 '12 at 04:52
  • please replay i need your help – Ghouse Jun 21 '12 at 06:57
0
UILabel *title = [[UILabel alloc]initWithFrame:CGRectMake(0, 0, 170, 60)];
    title.numberOfLines = 3;
    title.textAlignment = UITextAlignmentLeft;
    title.lineBreakMode = UILineBreakModeClip;
    title.font = [UIFont fontWithName:[[UIFont familyNames] objectAtIndex:1]  size:15];
    title.text = @"Hello Hello";
    title.textColor = [UIColor brownColor];
    title.adjustsFontSizeToFitWidth = YES;
    title.backgroundColor = [UIColor clearColor];

[self.view addSubview:title];
superGokuN
  • 1,399
  • 13
  • 28
0

Please try following:

Open your custom font file (i.e. .ttf file) in "Font-Book" application which is a mac application.

Check the name of these fonts in that "Font-Book" application. for eg. @"Wingdings.ttf"

And use following to load fonts:
[mine setFont:[UIFont fontWithName:@"Wingdings.ttf" size:20]];

You can also try below link:
Can't load custom font on iOS

Community
  • 1
  • 1