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

后端 未结 2 607
梦谈多话
梦谈多话 2020-12-19 15:27

I\'m trying to draw Arabic text onto a Bitmap for display:

Bitmap img = Bitmap.createBitmap( (int) f+100, 300, Config.RGB_565);
Canvas c = new Canvas();
c.se         


        
相关标签:
2条回答
  • 2020-12-19 15:41

    Canvas is practically a wrapper around the Canvas of Skia (native graphics engine). Skia doesn't perform any BiDi/reshaping, it simply draws sequences of glyphs.

    TextView, on the other way, uses a load of Android's text-related objects, among them Layout and derived classes which do simple (actually dumb) BiDi. Android's BiDi is very dumb that it can't even handle digits in RTL: 'طولي 180' is displayed 'طولي 081'.

    Personally I don't trust Android's current BiDi, and would write my own Unicode-BiDi compliant class and use it if I need. I suggest you use manual BiDi in addition to the manual reshaping bro. Remember: First BiDi, then reshape!

    Salam

    0 讨论(0)
  • 2020-12-19 15:51

    if you added single line attribute to textview ,you should delete this attribute and add maxLines="1"

    0 讨论(0)
提交回复
热议问题