Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6841827
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T00:00:54+00:00 2026-05-27T00:00:54+00:00

I’m working on an application that requires arabic text to be displayed, using custom

  • 0

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 text using custom arabic fonts. I’ve tried to display the text in UILabel, UITextField, UITextView, UIWebView, FontLabel (by Zynga), and using CoreText.

You can find sample projects here:

Sample application using UILabel, UITextField, UITextView and CoreText

Sample application using UIWebView (HTML)

Sample application using UIWebView (HTML): You’ll have to install the
fonts in the sample project. You can then compare the results and see
the problem by running the application in the simulator (or iPad), and
opening Sample.html file in the browser (Safari).

I’ve posted some details on Apple’s developer forum but i’ve always found stackoverflow to be much more active then Apple’s official developer forum. Here’s a link to that post:

Using custom arabic font in iOS

What am i doing wrong?

Note: The fonts are loaded into the system correctly, and i can successfully apply custom fonts to regular (english) text.

p.s. There are a couple of posts on stackoverflow that talk about this subject but none have been of much help, so i’m posting a new question.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T00:00:55+00:00Added an answer on May 27, 2026 at 12:00 am

    Update:

    As of iOS 7, you don’t really need to use Core Text to render custom arabic font. You can use UILabel and/or UITextView with NSAttributedString. The results are the same as you get using Core-Text. However, depending on your requirements, using Core Text can still be a better option.

    Update:

    I’ve reported this as a bug to Apple, but i’m not sure when they’ll add support for Arabic fonts. Currently, there’s no easy way to do it. I ended up using the default system font, which is not very good.

    Original Message

    I did managed to build a Quran application that uses custom arabic font. I used known arabic font(s) with Core Text framework to get the desired results. You can see the results I got in the end by checking the application Quran Presenter for iPad, which is available on the App Store.

    Here’s some sample code to help you out:

    - (CTFontRef)newCustomFontWithName:(NSString *)aFontName
                                ofType:(NSString *)type
                            attributes:(NSDictionary *)attributes {
        NSString *fontPath = [[NSBundle mainBundle] pathForResource:aFontName ofType:type];
    
        NSData *data = [[NSData alloc] initWithContentsOfFile:fontPath];
        CGDataProviderRef fontProvider = CGDataProviderCreateWithCFData((CFDataRef)data);
        [data release];
    
        CGFontRef cgFont = CGFontCreateWithDataProvider(fontProvider);
        CGDataProviderRelease(fontProvider);
    
        CTFontDescriptorRef fontDescriptor = CTFontDescriptorCreateWithAttributes((CFDictionaryRef)attributes);
        CTFontRef font = CTFontCreateWithGraphicsFont(cgFont, 0, NULL, fontDescriptor);
        CFRelease(fontDescriptor);
        CGFontRelease(cgFont);
        return font;
    }
    
    - (CATextLayer *)customCATextLayer {
        NSDictionary *attributes = [NSDictionary dictionaryWithObjectsAndKeys:
                                    [NSNumber numberWithFloat:24.f], (NSString *)kCTFontSizeAttribute,
                                    [NSNumber numberWithInt:1], (NSString *)kCTLigatureAttributeName,
                                    nil];
    
        CTFontRef font = [self newCustomFontWithName:@"PDMS_Saleem_QuranFont-signed" 
                                              ofType:@"ttf" 
                                          attributes:attributes];
    
        CATextLayer *normalTextLayer = [[CATextLayer alloc] init];
        normalTextLayer.font = font;
        normalTextLayer.string = NSLocalizedString(@"Sample", nil);
        normalTextLayer.wrapped = YES;
        normalTextLayer.foregroundColor = [[UIColor blackColor] CGColor];
        normalTextLayer.fontSize = 24.f;
        normalTextLayer.alignmentMode = kCAAlignmentCenter;
        normalTextLayer.frame = CGRectMake(0.f, 10.f, 320.f, 32.f);
    
        CFRelease(font);
        return [normalTextLayer autorelease];
    }
    
    - (void)viewDidLoad {
        [super viewDidLoad];
    
        CATextLayer *normalTextLayer = [self customCATextLayer];
        [self.customView.layer addSublayer:normalTextLayer];
    }
    

    Note that I’m using CATextLayer and CTFontRef. There are a few problems with this approach.
    1. You’ll have to live with the issues in the selected “custom arabic font”.
    2. You’ll have to use the arabic text that uses the extended characters supported by the font.

    HTH.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working with an upstream system that sometimes sends me text destined for HTML/XML
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build
I need a function that will clean a strings' special characters. I do NOT
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I've got a string that has curly quotes in it. I'd like to replace
I am reading a book about Javascript and jQuery and using one of the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.