View Single Post
Old 04-14-2013, 01:25 PM   #2
Doitsu
Wizard
Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.
 
Doitsu's Avatar
 
Posts: 4,225
Karma: 13659369
Join Date: Dec 2010
Device: Kindle PW2
While Unicode experts love to discuss these issues, in real life, there are hardly any problems, as long as you use the dir="rtl" attribute for predominantly RTL text. And even if you don't do this, RTL text will be mostly displayed correctly, if it doesn't contain embedded LTR text, except for final punctuation characters at the end of a paragraph, which will always be displayed on the right hand side, even if they should be displayed after the last word of the sentence on the light hand side.
Also most rendering engines automatically use RTL rendering & shaping, when they encounter Unicode glyphs that need to be rendered RTL and switch to LTR when they encounter Latin text. I.e. most of these fancy RTL/LTR embedding codes aren't really necessary in real life applications. (I.e. mostly RTL text with LTR segments and vice versa.) Also some of them aren't fully supported by rendering engines anyway.

Please find attached a simple test file that I just slapped together using a BBC Arabic article about the late Margret Thatcher. On the first HTML page I inserted her English name in an Arabic paragraph, and on the third page I inserted her (transliterated) Arabic name in an English paragraph. Both inserts where not enclosed by any special RTL or LTR embedding codes.

(The second HTML page shows what happens if you don't use the dir="rtl" attribute: punctuation characters are always displayed on the right hand side and inserted LTR text breaks up the paragraph.)

tl;dr RTL text rendering isn't as complicated as it looks like
Attached Thumbnails
Click image for larger version

Name:	chap3.JPG
Views:	251
Size:	60.3 KB
ID:	104365   Click image for larger version

Name:	chap2.JPG
Views:	260
Size:	68.2 KB
ID:	104366   Click image for larger version

Name:	chap1.JPG
Views:	248
Size:	69.6 KB
ID:	104367  
Attached Files
File Type: mobi RTL.mobi (119.5 KB, 144 views)
File Type: epub RTL.epub (61.9 KB, 120 views)
Doitsu is offline   Reply With Quote