3

I'm writing an android program that writes some text on image using "drawtext" method of "Canvas" class.

So i want to set alignment and direction of the text because my text is in Persian language

In order to set the alignment of the text i have used "paint.setTextAlign(Align.RIGHT)" method but i can't find any method or something else to set direction of text to right to left

In other words i want to use something like in "TextView" class : "setTextDirection(int)"

here is my code:

Paint paint = new Paint();
paint.setTypeface(typeFace);
paint.setColor(Color.BLUE); 
int fontSize = 30;
paint.setTextSize(fontSize);
paint.setTextAlign(Align.RIGHT);
canvas.drawText(textToWrite, bitmap.getWidth()/2, bitmap.getHeight() - fontSize , paint);

Sorry for poor English Thanks

Amir
  • 652
  • 9
  • 19

0 Answers0