Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Formats > Workshop

Notices

Reply
 
Thread Tools Search this Thread
Old 04-14-2013, 12:27 PM   #1
PoP
Antonín ♯♭♪♮♫ ᵖʸᶠᵍᶜʳˡ
PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.
 
PoP's Avatar
 
Posts: 519
Karma: 7391817
Join Date: Dec 2010
Location: ♁ ᴺ₄₅°₃₀' ᵂ₇₃°₃₇' ±₆₀"
Device: K3.₄, PRS-350, SGS3, Rπ, iPad Air
Understanding bidirectional Unicode control characters

When "studying" Unicode specifications I came across Carl Henderson's remarkably clear and concise illustration of understanding bidirectional text.

I extracted the .html from his page and I created a .mobi and a .azw3 to test the capabilities of my Kindle Keyboard v3.4. The expected behaviour is explained in the text along with coding and rendering examples, greatly enhancing the comprehension.

The subject is relatively complex and certainly not trivial. (I think) I *do* understand it now (?)... So can you! Hoping you find it useful to test other browsers and ereaders.

I have identified the following rendering errors (I think) . And I would appreciate if a dedicated and applied reader interested in this subject could confirm my understanding.

When Adobe Acrobat XI Pro v11.0, Firefox v20.0.1 or Microsoft Internet Explorer v10.0 render the .html
The "implicit marker, third case"
Click image for larger version

Name:	case1 implicit 3rd example.jpg
Views:	78
Size:	11.6 KB
ID:	104359
Can all these good software be doing that same error?!

After converting the .html to .mobi with Kindle Previewer v2.85, to .azw3 with Calibre 0.9.27 and viewing them in my Kindle Keyboard v3.4
The "implicit marker, first case"
Click image for larger version

Name:	case2 implicit 1st example.jpg
Views:	78
Size:	13.2 KB
ID:	104360

Open my test files below to better see what I mean:
Attached Files
File Type: zip 2013-04-14 test files.zip (474.3 KB, 42 views)
PoP is offline   Reply With Quote
Old 04-14-2013, 02: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: 2,127
Karma: 4938208
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:	109
Size:	60.3 KB
ID:	104365   Click image for larger version

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

Name:	chap1.JPG
Views:	106
Size:	69.6 KB
ID:	104367  
Attached Files
File Type: mobi RTL.mobi (119.5 KB, 94 views)
File Type: epub RTL.epub (61.9 KB, 62 views)
Doitsu is offline   Reply With Quote
 
Advertisement
Old 04-14-2013, 02:55 PM   #3
PoP
Antonín ♯♭♪♮♫ ᵖʸᶠᵍᶜʳˡ
PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.
 
PoP's Avatar
 
Posts: 519
Karma: 7391817
Join Date: Dec 2010
Location: ♁ ᴺ₄₅°₃₀' ᵂ₇₃°₃₇' ±₆₀"
Device: K3.₄, PRS-350, SGS3, Rπ, iPad Air
So true. Thanks for your explanations and real life examples. Your wise advice (and the rendering errors I pointed to) show how to stay out of trouble.

I am still just an apprentice, but it was dnatsrednu ot nuf hcum! admittedly spending far too much time on the theory.

Again, sincere thanks for sharing your expertise.
PoP is offline   Reply With Quote
Old 04-15-2013, 01:25 AM   #4
neufsix
Connoisseur
neufsix can extract oil from cheeseneufsix can extract oil from cheeseneufsix can extract oil from cheeseneufsix can extract oil from cheeseneufsix can extract oil from cheeseneufsix can extract oil from cheeseneufsix can extract oil from cheeseneufsix can extract oil from cheese
 
Posts: 57
Karma: 1010
Join Date: Jul 2011
Device: Archos A70 eReader, Kindle Touch, Sony PRS-T2
Thank you! I planned to work on a book mixing latin and hebrew charaters, it comes in handy.
neufsix is offline   Reply With Quote
Old 04-15-2013, 04:33 AM   #5
HarryT
eBook Enthusiast
HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.
 
HarryT's Avatar
 
Posts: 65,477
Karma: 43935573
Join Date: Nov 2006
Location: UK
Device: Kindle Voyage, iPad Mini, iPhone 4, MS Surface Pro, N7
Does ADE support RTL languages these days? ISTR that earlier versions of it didn't.
HarryT is online now   Reply With Quote
Old 04-15-2013, 05:28 AM   #6
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: 2,127
Karma: 4938208
Join Date: Dec 2010
Device: Kindle PW2
Quote:
Originally Posted by HarryT View Post
Does ADE support RTL languages these days? ISTR that earlier versions of it didn't.
AFAIK, the latest ADE version still doesn't support Arabic. However, it's possible to display Arabic text (without vowel signs) with ADE, if you're willing to jump through some hoops.

1. You'll obviously need to embed an Arabic font
2. You'll need to manually generate the Arabic context forms.
3. You'll need to reverse the order of the preshaped Arabic letters.

(The last two steps can be accomplished with this free tool.)

Since all of this is a major PITA, it's only practical for very short quotes, but it can be done.

Please find attached an excerpt from a German book available at MR that demonstrates this technique.
Attached Thumbnails
Click image for larger version

Name:	ADE_Arabic.JPG
Views:	69
Size:	80.9 KB
ID:	104394  
Attached Files
File Type: epub ADE_RTL_TEST.epub (365.8 KB, 39 views)

Last edited by Doitsu; 04-15-2013 at 03:12 PM. Reason: Removed unused styles and fonts & added some comments
Doitsu is offline   Reply With Quote
Old 04-15-2013, 05:43 AM   #7
HarryT
eBook Enthusiast
HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.
 
HarryT's Avatar
 
Posts: 65,477
Karma: 43935573
Join Date: Nov 2006
Location: UK
Device: Kindle Voyage, iPad Mini, iPhone 4, MS Surface Pro, N7
Ouch - that does sound painful. And presumably, if you reverse the order of the letters, and then do a conversion to a format which does support RTL, such as KF8, you'd need to reverse the letters again to make it display correctly!
HarryT is online now   Reply With Quote
Old 04-15-2013, 06:10 AM   #8
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: 2,127
Karma: 4938208
Join Date: Dec 2010
Device: Kindle PW2
Quote:
Originally Posted by HarryT View Post
Ouch - that does sound painful. And presumably, if you reverse the order of the letters, and then do a conversion to a format which does support RTL, such as KF8, you'd need to reverse the letters again to make it display correctly!
Actually, that part isn't so complicated. You can use this clever method that Jellby came up with to test for ADE readers and have all non-ADE readers display regular Arabic text.

(Note the additional vowel signs on the first Arabic word in the screenshot of the Kindle version, which was generated without further modification from the .epub file attached to my previous post.)
Attached Thumbnails
Click image for larger version

Name:	Kindle_Arabic.JPG
Views:	81
Size:	113.4 KB
ID:	104397  
Doitsu is offline   Reply With Quote
Old 04-15-2013, 06:16 AM   #9
HarryT
eBook Enthusiast
HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.
 
HarryT's Avatar
 
Posts: 65,477
Karma: 43935573
Join Date: Nov 2006
Location: UK
Device: Kindle Voyage, iPad Mini, iPhone 4, MS Surface Pro, N7
Very cunning - thanks!
HarryT is online now   Reply With Quote
Old 04-27-2013, 12:01 PM   #10
PoP
Antonín ♯♭♪♮♫ ᵖʸᶠᵍᶜʳˡ
PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.
 
PoP's Avatar
 
Posts: 519
Karma: 7391817
Join Date: Dec 2010
Location: ♁ ᴺ₄₅°₃₀' ᵂ₇₃°₃₇' ±₆₀"
Device: K3.₄, PRS-350, SGS3, Rπ, iPad Air
Quote:
Originally Posted by Doitsu View Post
AFAIK, the latest ADE version still doesn't support Arabic. However, it's possible to display Arabic text (without vowel signs) with ADE, if you're willing to jump through some hoops.

1. You'll obviously need to embed an Arabic font
2. You'll need to manually generate the Arabic context forms.
3. You'll need to reverse the order of the preshaped Arabic letters.

(The last two steps can be accomplished with this free tool.)

Since all of this is a major PITA, it's only practical for very short quotes, but it can be done.

Please find attached an excerpt from a German book available at MR that demonstrates this technique.
While playing some more with text transformations:
Spoiler:
Code:
<?xml version='1.0' encoding='utf-8'?>
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <style> 

div
{
width:500px;
height:75px;
border:1px solid black;
text-align:center;
}

.rx
{
transform:rotateX(180deg);
-webkit-transform:rotateX(180deg);
}

.ry
{
transform:rotateY(180deg);
-webkit-transform:rotateY(180deg);
}

.rz
{
transform: rotate(180deg);
-webkit-transform:rotate(180deg);
}

.rx120
{
transform:rotateX(120deg);
-webkit-transform:rotateX(120deg);
}

</style>
    <title>CSS3 &amp; other transforms</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
  </head>
  <body>

<p>no transform : 
</p><div>© Copyleft Creative Common Share Alike License</div><p></p>

<p>3D -webkit-transform:rotateX(180deg);
</p><div class="rx">© Copyleft Creative Common Share Alike License</div><p></p>

<p>3D -webkit-transform:rotateY(180deg);
</p><div class="ry">© Copyleft Creative Common Share Alike License</div><p></p>

<p>2D -webkit-transform:rotate(180deg);
</p><div class="rz">© Copyleft Creative Common Share Alike License</div><p></p>

<p>3D -webkit-transform:rotateX(180deg); 3D -webkit-transform:rotateY(180deg);
</p><div class="rx"><div class="ry">© Copyleft Creative Common Share Alike License</div></div><p></p>

<p>3D -webkit-transform:rotateX(180deg); 2D -webkit-transform:rotate(180deg);
</p><div class="rx"><div class="rz">© Copyleft Creative Common Share Alike License</div></div><p></p>

<p>3D -webkit-transform:rotateY(180deg); 2D -webkit-transform:rotate(180deg);
</p><div class="ry"><div class="rz">© Copyleft Creative Common Share Alike License</div></div><p></p>

<p>3D -webkit-transform:rotateX(180deg); 3D -webkit-transform:rotateY(180deg); 2D -webkit-transform:rotate(180deg);
</p><div class="rx"><div class="ry"><div class="rz">© Copyleft Creative Common Share Alike License</div></div></div><p></p>

<p>&lt;bdo dir="rtl"&gt; </p><div><bdo dir="rtl">© Copyleft Creative Common Share Alike License</bdo></div><p></p>

<p>3D -webkit-transform:rotateX(120deg);
</p><div class="rx120">© Copyleft Creative Common Share Alike License</div><p></p>


</body></html>


I thought that the <bdo dir="rtl"> tag in my example #9 could possibly ease step 3.
Click image for larger version

Name:	15519.gif
Views:	91
Size:	25.3 KB
ID:	105034Click image for larger version

Name:	15520.gif
Views:	90
Size:	22.7 KB
ID:	105035Click image for larger version

Name:	15521.gif
Views:	87
Size:	9.2 KB
ID:	105036

Though I still prefer the elegance of simple Unicode ʇɟǝןʎdoƆ (ↄ) for reversing (c) Copyright.
PoP is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Support of Special Unicode Characters? gawl ePub 6 03-27-2013 03:41 PM
Support of Special Unicode Characters in EPUB? gawl PocketBook 1 03-24-2013 06:12 AM
¿Convert unicode decomposed characters to unique/normal characters? JohnQwerty Calibre 3 04-05-2012 01:08 PM
Non-Roman Unicode Characters teh603 Writers' Corner 7 03-26-2012 12:06 PM
Reader adds space after unicode characters... bmfrosty Astak EZReader 2 07-16-2009 09:53 PM


All times are GMT -4. The time now is 08:16 AM.


MobileRead.com is a privately owned, operated and funded community.