You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
Arabic text is displayed incorrectly: the letters are not joined. Here's an image that explains how arabic text is supposed to be rendered:
However, I'm not sure if this may break other elements as the category Lo contains 127,004 character. Furthermore, this solution alone won't solve the issue of RTL languages (there's already an open issue #1145 for it). I did find a potential solution for this:
publicclassTextLayer extends BaseLayer {
...
private void drawFontTextLine(String text, DocumentData documentData, Canvas canvas, float tracking) {
Bidi bidi = new Bidi(text, Bidi.DIRECTION_DEFAULT_LEFT_TO_RIGHT);
List<String> charStringList = new ArrayList<>();
for (int i =0; i < text.length(); ) {
String charString = codePointToString(text, i);
charStringList.add(charString);
i += charString.length();
}
if (bidi.isRightToLeft()) {
Collections.reverse(charStringList);
}
for (String charString : charStringList) {
drawCharacterFromFont(charString, documentData, canvas);
float charWidth = fillPaint.measureText(charString);
float tx = charWidth + tracking;
canvas.translate(tx, 0);
}
}
}
After applying all the changes above, the animation looks correct:
device-2023-04-17-191243.mp4
What version of Lottie did you test this on?
6.0.0
What version of Android did you test this on?
Android 11
The text was updated successfully, but these errors were encountered:
Would you be willing to put up a pull request for this? I'm not an expert in RTL or non-latin languages so it would be great if somebody with more familiarity could take a look.
Describe the bug
Arabic text is displayed incorrectly: the letters are not joined. Here's an image that explains how arabic text is supposed to be rendered:
And here's how it looks like in Lottie:
device-2023-04-17-191627.mp4
Animation file: arabic.zip
This issue has been previously reported in #1755, and it was suppose to be resolved in #2001. Unfortunately, that doesn't seem to be the case.
I did investigate the issue. Adding
OTHER_LETTER
to theisModifier
function seems to fix it:However, I'm not sure if this may break other elements as the category Lo contains 127,004 character. Furthermore, this solution alone won't solve the issue of RTL languages (there's already an open issue #1145 for it). I did find a potential solution for this:
After applying all the changes above, the animation looks correct:
device-2023-04-17-191243.mp4
What version of Lottie did you test this on?
6.0.0
What version of Android did you test this on?
Android 11
The text was updated successfully, but these errors were encountered: