10

I want to display arabic fonts(me_quran fonts) in my app. I have arabic text in my database.

Example of arabic text : "بِسْمِ ٱللَّهِ ٱلرَّحْمَٰنِ ٱلرَّحِيمِ"

I have tried following things.

1) Try :

In info.plist file I have added .ttf file in the fonts provided by application option.

[UIFont fontWithName:@"me_quran" size:20.0];

2) Try :

Tried with the ArabicConverter demo code.

Results in the above try :

App is not displaying the proper arabic fonts. For example, it use to display circle where suppose to be half circle like moon shape. and many times it use to display only lines rather then line with some curves.

I got some links which are : link1 , link2. But this links does not contain much information on how to solve the problem.

The interesting thing which I got is to use glyphs to solve the problem. But I do not know how to use it?

Can anybody give me some idea or link on how to use glyphs in iOS? or any sample project ?

Community
  • 1
  • 1
Devang
  • 11,258
  • 13
  • 62
  • 100
  • Please 'accept' the most helpful answer by clicking on the check mark next to each answer. – Neeku Mar 22 '14 at 00:42
  • @Neeku : Non of the answer solved my problem, I have special fonts and its script, combination of this gives perfect arabic font in iOS. I really appreciate your help but it did not help me. – Devang Mar 22 '14 at 04:41
  • Ah, ok. How about sharing your script with us? I had one and it never worked with iOS 7! – Neeku Mar 22 '14 at 10:00
  • @Neeku : Sorry we had paid high price for that. It works well with all iOS versions. – Devang Mar 22 '14 at 10:04

3 Answers3

3

Arabic/Persian fonts are not well-defined in Xcode, and the only default font for them, is the "Geeza" font. I haven't used glyphs, but here's an API for Persian fonts, and that must work for Arabic fonts, too. Check it out, and see if that helps.

Neeku
  • 3,646
  • 8
  • 33
  • 43
1

Salam,

I have tried your example using ArabicConverter, and it worked with me, may be you are using a different font than me_quran

before using ArabicConverter:

after using ArabicConverter:

AhmedHofny
  • 116
  • 2
  • 3
0

Drag you font into resource section. Then add that file name in the info.plist fonts provided by application. this font name may differ from as in the .ttf name. so check the correct font name it will work.

check your font was matched correctly in the available font list

// List all fonts on iPhone
    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]);
        }

    }
Senthilkumar
  • 2,471
  • 4
  • 30
  • 50
  • your font name was display followed by the above code "Font name" NSLog section. – Senthilkumar Jun 16 '12 at 10:41
  • Yup.. If you know properly then iOS having bug with arabic fonts. But one of the app having proper arabic fonts. So there must be some way to use arabic fonts in iOS. Let me know if you have any other option. – Devang Jun 16 '12 at 10:48
  • @Devang is there any way to do that because I am also stuck in the same? – Deepika Lalra Jul 16 '13 at 09:46
  • @DeepikaLalra : Does your font is not loading or what ? – Devang Jul 16 '13 at 10:26
  • @Devang Custom font is working but when we try to populate that on UI its not showing some character properly. Can you please tell me the way how you perform this task, any library or something? – Deepika Lalra Jul 16 '13 at 12:28
  • @DeepikaLalra : There is issue with iOS and arabic font. So you will never get perfect arabic font on iOS. Else you need to design your own custom arabic font script and font also. – Devang Jul 17 '13 at 07:11