1

When I write arabic text in canvas by drawtext, in some device it is written correct but in others device it is revers. for example in some سلام and in other ﻢﺎﻟﺳ. I convert character by arabicReshaper to solve separate char problem in arabic form.

  1. How do I detect when word need to be reverse and when not.
  2. In some device پ character is shown correctly but in some other devices don't show that character. I use custom typeface and I sure typeface have پ character.
Ali
  • 2,012
  • 3
  • 25
  • 41

1 Answers1

0

First off, I suggest you to take a look at this link.

How do I detect when word need to be reverse and when not.

You can detect Persian character with the following function, so when the text is Persian you need to reverse their sequence.

     public boolean isPersian(String persianText)
     {
         return persianText.matches("/[\u0600-\u065F\u066A-\u06EF\u06FA-\u06FF]/");
     }

The above function return true if your string containing Persian characters (Not digit), otherwise returning false.

In some device پ character is shown correctly but in some other devices don't show that character. I use custom typeface and I sure typeface have پ character.

That is a bug and depend to your android version, In android 2.3, 2.2, etc this character is not displayed correctly and you can not do anything to fix it, However this problem is currently solved in ICS and JB.

Community
  • 1
  • 1
Ali
  • 2,012
  • 3
  • 25
  • 41