4

In my application i need to display arabic text with different custom fonts. I follow the scenario adding ttf files to info.plist.

As per above scenario i am successfully getting display text in different font style for ENGLISH text only. I am doing same thing for arabic font styles but here i am not getting. Why is going like that?

Please any one can help me

Thanks in Advance.

iAhmed
  • 6,556
  • 2
  • 25
  • 31
KAREEM MAHAMMED
  • 1,675
  • 14
  • 38

2 Answers2

6

@Kareem , I took hint from Stackoverflow itself to load the fonts but could not get it working in first go. May be following steps can help you .

  1. Add the font files to your project.
  2. Make their entries in info.plist file

    such as enter image description here

  3. you can now implement some method that loads your font somewhere in application delegate like

    -(UIFont*) CustomFontWithSize:(float)size{

        UIFont* customFont = [UIFont fontWithName:@"FX_Masa" size:size];
    
        if(customFont == nil)
            customFont = [UIFont systemFontOfSize:size];
    
        return customFont;
    }
    

If you notice then the name I have passes here is "FX_MASA" and not FX_MasaRegular , this was the point where I was wrong. The name that we need to use while fetching the font is the INSTALL NAME (Double click on the font to install the font on system and the name that appears in Font Book is the install name).

enter image description here

Hope this helps your problem as well. In case you come across any good method, please update here.

Rahul Sharma
  • 3,013
  • 1
  • 20
  • 47
  • Though I am still using it on device, If you come across any update , please do share with all of us. Thanks – Rahul Sharma Jul 11 '12 at 10:33
  • Also This was only a workaround that I could find. I now have a systematic approach that I use to add custom fonts in my application. – Rahul Sharma Jul 11 '12 at 10:34
0

There is a nice UILabel extension in GitHub called "Font Label": https://github.com/zynga/FontLabel This allows to load any TTF file and then draw ZLabel objects (ZLabel is an extension of UILabel) with this custom font. It is based on CoreGraphics and I tested with many custom fonts and proved to work correctly. I don't know of course the effect with arabic fonts, but it's worth a try and a feedback from you (to us and also the github project admins) is welcome.

viggio24
  • 12,316
  • 5
  • 41
  • 34
  • Hi thanks for response I tried above example it also doesn't give custom fonts for arabic. Is there any way for especially arabic like UNICODE etc... Please help in this issue Thanks for advance – KAREEM MAHAMMED Nov 22 '11 at 11:11