-1

In a UITextView is it possible to set the fontname.I want to display Telugu font in UITextview.This is the Telugu font family name "TeluguSangamMN-Bold".I am declaring Telugu font family in UITextview.But it is not worked for me.help me any body.

This is my code..

-(void)connectionDidFinishLoading:(NSURLConnection *)connection

{

[UIApplication sharedApplication].networkActivityIndicatorVisible=NO;

if(connection==urlConnection)

{

NSString *strResponse=[[NSString alloc]initWithData:responseData encoding:NSUTF8StringEncoding];

NSLog(@"String Response is : %@",strResponse);

NSRange r;

NSString * cleanString = [NSMutableString stringWithString:strResponse];

while ((r = [cleanString rangeOfString:@"<[^>]+>" options:NSRegularExpressionSearch]).location != NSNotFound)

cleanString = [cleanString stringByReplacingCharactersInRange:r withString:@"\n"];

text1.text=cleanString;

}

}

-(void)viewDidLoad

{

text1=[[UITextView alloc]initWithFrame:CGRectMake(10, 300, 300, 80)];

text1.font=[UIFont fontWithName:@"TeluguSangamMN-Bold" size:12];

text1.font=[UIFont boldSystemFontOfSize:12];

text1.backgroundColor=[UIColor whiteColor];

text1.editable=NO;

[self.view addSubview:text1];

}
Darshan Kunjadiya
  • 3,323
  • 1
  • 29
  • 31
user3655174
  • 83
  • 1
  • 1
  • 4
  • 1
    Remove the line text1.font=[UIFont boldSystemFontOfSize:12]; its not required. – essess May 22 '14 at 06:10
  • check this link ---> http://codewithchris.com/common-mistakes-with-adding-custom-fonts-to-your-ios-app/ – Maverick May 22 '14 at 06:12
  • possible duplicate of [Custom fonts in iOS 7](http://stackoverflow.com/questions/21737788/custom-fonts-in-ios-7) – aksh1t May 22 '14 at 06:15

4 Answers4

1

enter image description hereCheck wheter you have added the font file with extension .dfont ot .ttf in plist

madhu
  • 961
  • 9
  • 21
1

The font your trying to use is included in iOS 7.0.

You can check the installed font list Here Also in the nib file under Fonts it is displayed.

enter image description here

Prathamesh Saraf
  • 709
  • 4
  • 14
0
  1. Did you add the custom font file to INFO.PLIST
  2. Also the file name is not same as the font family name, try to loop into [UIFont familyNames] and check whether your font family name is listed.
  3. try to use the same family name in text1.font=[UIFont fontWithName:@"TeluguSangamMN-Bold" size:12];
nprd
  • 1,942
  • 1
  • 13
  • 16
0

First download your relevant font

Add your custom font into your project , i.e. Dragged the font file(Berlin Sans FB.TTF) into XCode project.

Add a new entry with the key "Fonts provided by application".

enter image description here

Now use this font in your textview

txtview.font = [UIFont fontWithName:@"Berlin Sans FB" size:15];

i used Berlin Sans FB you use your teleugu font

for more detail check this link

Gajendra Rawat
  • 3,673
  • 2
  • 19
  • 36