Search This Blog

Tuesday, April 14, 2009

Arabic in iPhone Safari Sourcsecode

Peace be upon you

This days, I have forward my focus into iPhone development, actually I have figured out too many things that I miss by not working for Mac :D
I am not going to get into debate or something like that but all I am going to say is "Apple definition for the word 'Framework' is much much much much better than anyone else"
Let us get to what I am coming to say today.

Today I would like to demonstrate some stuff related to Arabic inside WebKit which the core of Safari
I will sort then explain, as I don't have much time I will explain in hurry :D
First, to get the code , you have to download it from Apple Opensource section, here is link
http://www.opensource.apple.com/darwinsource/iPhone/
in the Article I have used the 2.2.1
so let us start with BiDi related function , this function called BidiCharacterRung, I put it here because I have noticed that it has some kind of detection for the Right To Left issue



shapeArabic, If you know about Arabic representaion, the reshaping is the phase which make the Arabic readable by the user

This line I like very much, this code prevent from showing "boxes" if the font is not exist


The function related to previous figure


  1. The first image shows that the Arabic is really solved in manar of character direct, this doesn't mean RTL, you can notice that in Safari because actually it showes Arabic is resolved and corrected but not Shaped
  2. The code showes that there is some work done in many levels, there is some code also to solve Arabic in the SVG render engine, which means that it is ready, I don't know why they didn't use it, may be it is little buggy
  3. I like this part very very much, in OS X, when you use font that doesn't have the glphy"the shape of the character" of the character, it will find anther font that does have a font containe the character, why this thing is very important, it think it is better to see the character than seeing squares :D, you can easily see this in Windows mobile if it doesn't has Arabic support by 3rd party
What do I think about this code is, this code is somekind of memory conuming, as I understand that the code doubles the buffer to manage to solve the bidi issue
I think it should be optimized some how.
anyways, I like the code it is very well commented, I really recommend you to review it,
it doesn't require any thing from Apple products to review this stuff.

I hope that anyone correct me if there is anything wrong

Thanks for your time.

BR
Ahmed Essam
There was an error in this gadget