mathew-kurian / TextJustify-Android

:page_facing_up: Android Text Full Jusiftication / Wrapping / Justify / Hyphenate - V2.0
https://github.com/bluejamesbond/TextJustify-Android/wiki
Apache License 2.0
1.86k stars 369 forks source link

Persian or arabic justification issue : reversed words #18

Closed miladrasooli closed 10 years ago

miladrasooli commented 10 years ago

Hi, I want to use your code for my app that is in Persian language, But when it draws text all the words are in reversed form.I think it is RTL problem that is not considered in the code. Thanks

mathew-kurian commented 10 years ago

The fix should be quite easy. All you have to is basically instead of drawing at horizontalOffset, you draw the text at width - horizontalOffset - wordLength - (and couple other margin offsets). I think should be able to fix this without having to mess with the code too much.

PS. I don't have a unit I can test my code on, so I really can't say too much. However, I can confirm that you modifications should not have to go outside of TextViewEx.java.

If you do get it to work, please do push the code, so that others can use it as well.

miladrasooli commented 10 years ago

Hi, Thank you for your advice... I changed some lines of code and now it is working (only) for RTL languages. https://github.com/miladrasooli/TextJustify-Android/commit/255d500d89e188f090e5c4ffb739952d2e89553e

Saleh-Hassan commented 10 years ago

You should try this: https://github.com/Saleh-Hassan/RTL-TextJustify-Android

mathew-kurian commented 10 years ago

Just do a pull request and I will merge with the updated code that I will push tomorrow night.