title: How to draw RTL text (Arabic) onto a Bitmap and have it ordered properly?
body: <p>I'm trying to draw Arabic text onto a Bitmap for display:</p>
  
  <pre><code>Bitmap img = Bitmap.createBitmap( (int) f+100, 300, Config.RGB_565);
  Canvas c = new Canvas();
  c.setBitmap(  img );
  mFace = Typeface.createFromAsset(getAssets(),"DejaVuSansCondensed.ttf");
  mPaint.setTypeface(mFace);
  content = "يجري";
  content = ArabicUtilities.reshape( content );
  System.out.println("Drawing text: " + content);
  c.drawText(content, 30, 30, mPaint);
  </code></pre>
  
  <p>The ArabicUtilities class is a tool to reshape the unicode text so the letters are connected. see: <a href="http://github.com/agawish/Better-Arabic-Reshaper/" rel="nofollow noreferrer">http://github.com/agawish/Better-Arabic-Reshaper/</a></p>
  
  <p>However, the bitmap that is generated looks like this:</p>
  
  <p><a href="http://imagebin.ca/img/J1EB8DWc.jpg" rel="nofollow noreferrer">alt text http://imagebin.ca/img/J1EB8DWc.jpg</a></p>
  
  <p>When it should look like <strong>يجري</strong></p>
  
  <p>I believe the issue is because, unlike a <a href="http://developer.android.com/reference/android/widget/TextView.html" rel="nofollow noreferrer">TextView</a>, the Bitmap class is not BiDi aware, so it draws the letters from left to write.</p>
  
  <p>Try as I might, I can't figure out how to draw the text in the correct order.</p>