2

I have an iPhone application that contains a webview. This webview renders an XHTML file which contains some Arabic text with CSS style. Everything works right with the style else the type of fonts, and if I change the contained text to English, the font type works right.

What is the problem with Arabic fonts?

Example:

@font-face {
    font-family: "AHRAM";
    font-style: normal;
    font-weight: bold;
    src:url("../Fonts/andlso.ttf") format("truetype");
}

@font-face {
    font-family: "DroidSans";
    font-style: normal;
    font-weight: normal;
    src:url("../Fonts/arabtype.ttf") format("truetype");
}
@font-face {
    font-family: "DroidSansFallback";
    font-style: normal;
    font-weight: normal;
    src:url("../Fonts/A_Nefel_Adeti.ttf") format("truetype");
}

p.line1 {
    font-family: "AHRAM";
}

p.line2 {
    font-family: "DroidSans";
}

p.line3 {
    font-family: "DroidSansFallback";
}




    <head>
        <link href="../Styles/p1.css" rel="stylesheet" type="text/css" />
    </head>

    <body>
        <p class="line1"> أهلاً بكم </p>
        <p class="line2"> أهلاً بكم </p>
        <p class="line3"> أهلاً بكم </p>
    </body>
</html>
Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Muhammad Shaker
  • 163
  • 3
  • 14
  • Check out the answer and it's comments here: http://stackoverflow.com/questions/5869452/arabic-ttf-truetype-font-in-uiwebview-ios-4-2-1 Does that help? – Niklas Berglund Jun 19 '12 at 17:34
  • Unfortunately no answer on the question, the guys who was talking about the question proceed their conversation out of the website :D I'll try to contact them, but for now any body has answer? – Muhammad Shaker Jun 19 '12 at 17:48
  • 1
    The problem is not with the font, it's with iOS. It's a known issue. If you want to show arabic text with custom arabic font, you'll have to use (experiment with) Core Text - That's what worked for me. Hope this helps. – Mustafa Jun 20 '12 at 14:46
  • possible duplicate of [How to use a custom font inside a UIWebView](http://stackoverflow.com/questions/11066349/how-to-use-a-custom-font-inside-a-uiwebview) – ismail Apr 17 '13 at 09:43
  • Possible duplicate of *[Custom Arabic font in iOS](http://stackoverflow.com/questions/3691567/custom-arabic-font-in-ios)*. – Peter Mortensen Sep 07 '13 at 22:18

1 Answers1

1

This seems to be a bug in iOS.

For a more details and a possible workaround check my answer here: https://stackoverflow.com/a/4361653/73195

Community
  • 1
  • 1
Hejazi
  • 16,587
  • 9
  • 52
  • 67