-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
solve issue #1158 (enabling Right-to-Left fonts) #1685
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Some parts need testing
…nt. Not sure if that will break the import from assetmanager.loadFont
Some parts need testing
If the boolean RtL should not be set via Bitmaptext, te whole class could be unchanged
…for RtL text. (it was deducted twice before) Still not sure if it is correct that way.
If the boolean RtL should not be set via Bitmaptext, te whole class could be unchanged
…o have the same result for LtR texts as it is given by BitMapFont.getLineWidth.
…dth() and BitmapFont.getLineWidth() will now have the same results. A few open ToDo and tests have been solvd/closed.
|
Did you mean "Right to Left" in the above? |
|
I appreciate the hard work that went into this PR. Thank you for contributing to the project! |
|
@pspeed42 - Yes of course. Right to Left texts... |
|
Why was the "local.properties" file deleted? @pspeed42 Do you have any desire to review this PR? |
|
I should probably give it a glance at least. |
I realized it was added by my JDK. It contained a warning saying remove before publishing and contained system info of the computer I had used. |
Will you have time to do so during the next 10 days? |
"local.properties" has been part of the Engine since 2015. I'm unsure what it does, but if it doesn't relate to this PR, please restore it. |
# Conflicts: # local.properties
|
I (hope) I have just restored the local.properties |
stephengold
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I want to get this PR integrated before beta, and I don't know when @pspeed42 is going to get a chance to look at it, so did a quick pass. If anything's unclear, please discuss.
jme3-examples/src/main/java/jme3test/gui/TestRtlBitmapText.java
Outdated
Show resolved
Hide resolved
jme3-examples/src/main/java/jme3test/gui/TestRtlBitmapText.java
Outdated
Show resolved
Hide resolved
jme3-examples/src/main/java/jme3test/gui/TestRtlBitmapText.java
Outdated
Show resolved
Hide resolved
jme3-examples/src/main/java/jme3test/gui/TestRtlBitmapText.java
Outdated
Show resolved
Hide resolved
|
I fixed some of the change requests. |
|
I have implemented GlyphParser for Persian text, should we include it in the repo as well? |
Language-specific features seem like the sort of thing that should be in https://github.com/jMonkeyEngine-Contributions or at the JmonkeyStore, not jme3-core. |
|
Added a commit to serialize "rightToLeft" field in BitmapFont. Should "glyphParser" field in the BitmapFont be serialized as well? ( |
I think if the font got saved for some reason, you'd want to serialize the parser as well. So yes. It might be okay not to clone the glyphParser, however, at least if you document that detail. |
|
Want to mention one more thing, that's about using numbers inside RTL text (bidirectional text). Swing uses Unicode Bidirectional Algorithm to handle RTL mixed with LTR text. In the case of JME, I managed to fix this issue inside the glyph parser simply by reversing the numbers. |
|
Seems worth documenting in a comment somewhere. Probably in |
Done.
I will document this inside the PersianGlyphParser implementation, which I will add it to jMonkeyEngine-Contributions page later. Then I will add a link to it inside GlyphParser interface. Like this: "For an example implementation see [link to PersianGlyphParser]." What do you think? |
|
Sorry, I can't follow that link. Retry? Edit: Sorry I misunderstood. Yes, including a URL in the |
…tToLeft" should be specified in the font.
|
Deprecated the |
|
I noticed setting text horizontal alignment to the |
… alignment was set to anything other than VAlign.Top also made some code cleanup.
|
And this is the GlyphParser implementation for Persian text: |
Done |
|
I believe this is ready for integration. Unless there's further discussion, I plan to fix a few stylistic issues and integrate this in about 24 hours. |
|
The "local.properties" file will soon be addressed by PR #1708. |
|
Thanks, @stephengold :) |
This pull request is solving the problem with displaying Right to Left texts in JME. fixes #1158 and would also make the additional file for testcase close #1159 unnecessary.
More info could be found in the forum or in the discussion for issue #1158.
What changed:
Beside repairing the behaviour of RtL texts, a new parameter in BitMapfont allowing to set the textdirection in the font and in Bitmaptext. Before that was not possible in the font itself.
An interface "GlyphParser" now allowing the user of Persian, Arabic or other RtL oriented fonts to use individual parsers for the correct position of letters in a text (that may differ depending on letter before or after that) something that is not needed for Left to Rights texts.
Also a new discovered bug that brings different results for linewidth from BitmapText.getLineWidth() and BitmapFont.getLineWidth() for textinput with multilines had been fixed.
We have tested it and feel the PR is ready for review.
Edit: Of course it is Right to Left texts (at least I wrote it wrong on each occasion in the text)