2

How can I output text Right to Left (i.e. in reverse order) using Canvas.drawText ? Is there a way?

yydl
  • 23,868
  • 16
  • 63
  • 101

2 Answers2

1

Set Paint.Align property in your textPaint object, if you set it RIGHT -- The text is drawn to the left of the x,y origin:

textPaint.setTextAlign(Paint.Align.RIGHT);
canvas.drawText("your text here", getRight(), getY()/2, textPaint);
Michael
  • 3,270
  • 5
  • 22
  • 36
Kavis
  • 98
  • 4
0

Check this out: How to draw RTL text (Arabic) onto a Bitmap and have it ordered properly?

Community
  • 1
  • 1
iluxa
  • 6,883
  • 17
  • 34
  • But how do you "use manual BiDi"? In other words, assuming I can detect that I should be going to right to left, how do I tell the drawText function to output the text in reverse? – yydl Apr 07 '11 at 22:28