Thursday, May 30, 2013

Arabic support on non-rooted Nook Simple Touch

Nook simple touch is the second generation of e-readers made by B&N, although it's released in 2011, it’s based on Android 2.1 (released in 2009!), and hence its native support for Arabic eBooks is very poor, combined with fact you can't change system fonts , all you will see is bunch of ? A square here is a sample of Arabic Epub book on NST:

So, is there any way to overcome this problem?
Rooting is the easy and the best way , once the device is rooted , you can replace certain files with patched ones +replacing DroidSansFallback.ttf with any Arabic font ( I use DroidSansNaskh (don't forget to rename it )  in /system/fonts to have proper support of Arabic, once done you will see Arabic texts  in most apps (ES file explorer, EzpdfReader , etc)

For Arabic Eups reading I highly recommend using moon reader+ pro 1.6 or any version that supports RTL (Right to left texts) .

 Even with this method B&N stock reader won't display Arabic texts properly  as its engine doesn't understand/support RTL . 

So, all mentioned above is for rooted devices, what about poor non-rooted NST users?
Well, here what I did
 [css font hack]
  1. first we are gonna use sigil as epub creator tool ...
  2. create a new epub file 
  3. add Droid Sans Naskh font to your Fonts folder
  4. edit the html source and add the following 

@namespace h "";
@font-face {  
 font-family: "Droid Sans Naskh"  
 font-weight: normal;  
 font-style: normal;  
 src: url('../Fonts/DroidSansNaskh.ttf');  

Now the hard part,
By default, as you can see above, NST reader displays the Arabic words reversed and with un-connected letters, so we need to modify the text in a form NST can display properly
They are different way to do it but the most accurate way is to use php class called PHP-AR
To use the script, I will assume you use Linux,
·         Install php on your system
·         Extract the file to any folder you like
·         Create 1.php file in the I18N folder and paste the following code

  include 'Arabic.php';  
 $lines = @file("1.txt");  
 $obj = new I18N_Arabic('Glyphs');  
 foreach($lines as $line ){  
 $text = $obj->utf8Glyphs($line);  
 echo "$text \n" ;  
Paste your Arabic text in a txt file named 1.txt
In your terminal cd to the I18N directory
cd /home/live/Downloads/Arabic-3.6.0/I18N
Execute the following command
php a.php >2.txt
The converted Arabic text will be saved in 2.txt
Open the file and copy the incomprehensible back to sigil, save your work.
This is how the file will be displayed using NST reader
The result is satisfying =) , thanks to the php-Ar class , diacritics handled and displayed properly on the NST., but alef-lam combinations needs some work from the developer.
You can download all the files needed from this link

If you have a question, or want a clarification, leave a comment