Code Monkey home page Code Monkey logo

Comments (11)

narutouzumaki32 avatar narutouzumaki32 commented on July 28, 2024 1

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.

saeedjassani avatar saeedjassani commented on July 28, 2024 1

@samanmari use documentView.getLayoutParams().setReverse(true)

from textjustify-android.

mathew-kurian avatar mathew-kurian commented on July 28, 2024
  1. I am not sure about. Can you explain more?
  2. Yes you can. documentView.getLayoutParams().setReverse(true)

from textjustify-android.

khaledhosny avatar khaledhosny commented on July 28, 2024

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.

mathew-kurian avatar mathew-kurian commented on July 28, 2024

I don't know Arabic unfortunately, so can you give me rules that might help imrpove this library.

from textjustify-android.

khaledhosny avatar khaledhosny commented on July 28, 2024

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.

mathew-kurian avatar mathew-kurian commented on July 28, 2024

@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.

Shuhrat-java avatar Shuhrat-java commented on July 28, 2024

@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.

Shuhrat-java avatar Shuhrat-java commented on July 28, 2024

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.

mathew-kurian avatar mathew-kurian commented on July 28, 2024

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.

mathew-kurian avatar mathew-kurian commented on July 28, 2024

@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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.