Skip to content
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

Support for RTL languages #9

Open
deltabeard opened this issue Aug 19, 2020 · 3 comments
Open

Support for RTL languages #9

deltabeard opened this issue Aug 19, 2020 · 3 comments

Comments

@deltabeard
Copy link

RTL languages, such as Persian, are rendered as though they are LTR text, and therefore appear disjointed as shown below.

Image showing issue with rendering RTL text

Are there any plans to add support for RTL languages?

Many thanks.

Persian test text

@tomolt
Copy link
Owner

tomolt commented Aug 20, 2020

Yes, RTL languages are something that I want to support, but I'm not sure when I'll get around to it.

I will have to do more research on how they are implemented in TrueType first.
But, if they work the way I think they do, then there will be no changes to libschrift necessary -
It is likely just sftdemo (and any other application that uses libschrift) that has to be changed.

Things get complicated though if an application wishes to support mixed LTR and RTL text (which is very likely).
Then they will need an algorithm that swaps characters around until the entire text is completely LTR (or RTL).
For Unicode, this "BiDi" algorithm is standardized.
But just the reference implementation of that algorithm is two times as large as the entirety of libschrift...

By the way, thanks for the sample text.

@deltabeard
Copy link
Author

Thank you for your reply and for your great work so far. I'm personally not bothered about LTR and RTL being mixed within the same text. But I wonder if that issue applies to numbers in Persian, which are written LTR within text that is RTL, as shown below.

بیش از ۹۰۰۰ است

The sample text is the poem Bani Adam written by Iranian poet Saadi in 1258. I sourced the text from https://en.wikipedia.org/wiki/Bani_Adam 🙂

@maandree
Copy link
Contributor

maandree commented Aug 5, 2021

When you say disjoined, you mean that text shaping is missing right? Which instead really an RTL issue. RTL, without bidirectional text support, is simply solved by mirroring text without mirroring the glyphs (I think there are some glyphs you have to substitute for mirrored versions, such as brackets), but text shaping is more involved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants