Comments (11)
Thanks for this great shared library, but it cannot support persian or arabic text.
When I set direction, my word draw from last to start, instead of start to last.
I means this: my Word is : "سلام" and its draw like this: "مالس" .
(if you dont understand persian see this example: let me "1234" -> "4321" )
from textjustify-android.
@samanmari use documentView.getLayoutParams().setReverse(true)
from textjustify-android.
- I am not sure about. Can you explain more?
- Yes you can.
documentView.getLayoutParams().setReverse(true)
from textjustify-android.
Can you give examples of Arabic text with spaces between parts of the same word, I don’t think such spaces are valid.
from textjustify-android.
I don't know Arabic unfortunately, so can you give me rules that might help imrpove this library.
from textjustify-android.
My question was for the OP actually.
Basic Arabic script justification requires just increasing the spacing between words (just like basic Latin justification), and no letter-spacing at all (letter-spacing is not allowed in Arabic or any other cursive script as it breaks word shaping). Also there is generally no hyphenation in Arabic (some languages using the Arabic script allow hyphenation, though that is the exception not the rule).
More advanced Arabic justification would require word elongation (AKA kashida), but that is much harder to achieve as it is font-dependent and the current font formats and layout engine provide very little (or even nothing at all) to properly handle it, so I think it can be ignored for now.
from textjustify-android.
@khaledhosny Currently, the library only increases spacing between letters in words only if words don't fit inside one line. And I will look into kashida when I get a chance
from textjustify-android.
@bluejamesbond documentView.getLayoutParams().setReverse(true) this will reverse all text given. However in my text there is arabic text with translation. So reverse method affecting all text, including translated text. Also without reversing, when we use Arabic Reshaper Utilities(https://github.com/agawish/Better-Arabic-Reshaper/) for arabic text, words are appearing in correct way but their position is not correct, I mean words appearing from LTR not RTL
from textjustify-android.
We have mixed arabic and formatted text, how could we get correct text using documentlayout? Could you provide with some sample code?
from textjustify-android.
Try DirectionSpan
. Set it as you would any other span. Just remember mixing left-to-right with right-to-left can cause unintended results if they are in the same line.
new DirectionSpan(Direction.RIGHT_TO_LEFT)
EDIT: I apologize this is embarrassing. I had created the classes in all intention of adding support, but didn't have the time. So, this feature is yet to be added.
from textjustify-android.
@Shuhratjava I have added support, but it is barely tested so i will release it as a snapshot which is accessible via gradle at 2.0.7-SNAPSHOT
. Let me know if you have any problems.
Please refer to MixedRTLTest for how to use DirectionSpans
from textjustify-android.
Related Issues (20)
- How to set RTL for Arabic Text
- Extra space in AlertDialog
- max line limit HOT 1
- com.bluejamesbond.text.StringDocumentLayout$PlainDocumentException: Cannot fit word(s) into one line. Font size too large? HOT 2
- is Html text Support ?
- bug java.lang.IllegalArgumentException:
- How to change the text size? HOT 3
- java.lang.IndexOutOfBoundsException HOT 2
- Crash on Android 7.X
- DocumentViews in LinearLayout and EventListeners
- Background Color does not change with Spannables, please help.
- DocumentView has a problem with ExpandableListView
- RTL supprot for documentView_textFormat="plain"
- Broken on API 21 when change portrait to landscape positions
- Hyphenate license
- Image Span test does not work
- Report crash .onMeasure
- How to use android:ellipsize="end" attributes????
- bug: java.lang.IllegalArgumentException: width and height must be > 0
- onClick in Clickablespan is not work HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from textjustify-android.