Jump to content

Problem with displaying colorized Persian text


alijsh

Recommended Posts

Hi everybody,I hope here is the right place to pose my question. I have written a program for conjugating Persian verbs using PHP. I have used different colors for displaying conjugational elements using different SPAN tags but they are displayed incorrectly in Firefox and Opera. The final y's appear separately (داشت‌ی می‌بست‌ی) whereas in Internet Explorer it's displayed correctly (داشتی می‌بستی). Does anybody know how I can diplsay them correctly? I think there's something wrong with handling Arabic script because when I write the Persian in Latin script, they are displayed correctly. See this:

<p style="font-family:tahoma,sans-serif;"><span style="color:#0000bb;">داشت</span><span style="color:#dd0000;">ی</span> <span style="color:#ff00ff;">می‌</span>بست<span style="color:#dd0000;">ی</span></p><p style="font-family:tahoma,sans-serif;"><span style="color:#0000bb;">dâšt</span><span style="color:#dd0000;">i</span> <span style="color:#ff00ff;">mi</span>bast<span style="color:#dd0000;">i</span></p>

The Latin version is displayed correctly. I have also tried it with FONT tag.Hope somebody can help me.

Link to comment
Share on other sites

Uh... seperated as in not cursive? (I can't read Persian)That is because due to the span tags FF and OP displays it as two words. You can have an alternate version for those that uses the :first-letter pseudo-element instead, but due to the peculiarities of rtl scripts this may not work

<style type="text/css">span.verb {font-family:tahoma,sans-serif;color:#0000bb;}span.verb:first-letter {color:#dd0000;}</style>

and

<span class="verb">Ù…ÛŒ‌بستÛÅ’</span> <span class="verb">داشتÛÅ’</span>

(The charset messes up the characters but you get the point :) )

Link to comment
Share on other sites

Thanks Synook for your reply. There's no need to resort to pseudo-classes because the SPAN's already take their colors correctly. The problem is in rendering the Persian text and evidently it's a known issue in FF. You know, in Arabic writing system, certain characters have different shapes based on their position in the word (initial, medial, final). The FF and OP have rendered the initial chars of the SPAN's as if they are in initial position of a word. So we can't do anything and I have to check user's browser and use colorization only if it's IE.

Link to comment
Share on other sites

  • 1 year later...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...