Arabic text with custom fonts in iOS

前端 未结 5 1965
礼貌的吻别
礼貌的吻别 2020-12-16 06:33

I\'m working on an application that requires arabic text to be displayed, using custom arabic font. The problem is that i\'m not having any luck in displaying the arabic tex

5条回答
  •  隐瞒了意图╮
    2020-12-16 06:47

    These classes will do the job :

    https://github.com/Accorpa/Arabic-Converter-From-and-To-Arabic-Presentation-Forms-B

    Download them, and I'm pretty sure that answers your question because I had the exact same problem before!

    An example of the code :

    ArabicConverter *converter = [[ArabicConverter alloc] init];
    NSString* convertedString = [converter convertArabic:@"منذ دقيقة"];
    infoText.font = [UIFont fontWithName:@"YOUARABICFONT" size:16];
    infoText.text = convertedString;
    

    Now infoText will display the font correctly :)

提交回复
热议问题