-
Notifications
You must be signed in to change notification settings - Fork 318
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 bidirectional text and glyph shaping #211
Comments
Yes, we don't currently support bidirectional text (neither Unicode-based or in RCSS) or ligatures. I don't think it's realistic for us to implement text rendering and Unicode support as well as Firefox and other web browsers. Here's a great article on the complexities they need to deal with. And for text rendering changes we also need improved text editing logic which can be surprisingly complex as well. With that said, I'm all for adding ligatures and RTL support. However, RTL support in particular should involve somebody who needs it and uses it on a regular basis so they can maintain it and fix bugs that pop up. |
Since I really appreciate the library and all the effort that has went into it, I'd like to give my two cents in hopes of furthering its reach in terms of internationalization. First of all, I perfectly agree with @mikke89 in that implementing such functionality would be relatively complex and would require significant insight and possibly even first-hand experience with such languages. Generally speaking, I advocate the use of well-established technologies in such cases, mainly because of the sheer amount of domain-specific knowledge and experience that has been accumulated within them. As such, it'd be worth considering whether integrating a text shaping library that supports RTL out of the box would better serve this project, whose main focus - from my understanding - is not centered around text shaping. In my opinion, making such a move would both eliminate a potential maintenance burden and help pave the way for broader adoption. I'd recommend taking a look at HarfBuzz, for example. |
You make a great point, and I completely agree. Integrating HarfBuzz should be the way forward rather than trying to make something along these lines ourselves. I wonder how much work it will be to integrate it? It doesn't seem overly complicated, but of course we all know these things are bigger projects than they seem like at first. I'd love to see someone do a proof-of-concept or start the integration process. I would be very much interested in following up on that. I'm a bit worried that it might bloat the size of RmlUi applications, especially for those who mainly care about English and some occasional symbols. I think an integration should be optional if possible. What would be cool is perhaps the ability to select between two different font engines, one simple based on an integrated stb_truetype, and another based on FreeType+HarfBuzz. |
It'd be quite difficult for me to predict the effort required, as I'm not particularly well-versed in font rendering. The Moving on, I do understand the motive behind trying to keep the resulting binary compact, but I'd personally refrain from maintaining multiple implementations until both measurements - quite simple ones, in this case - and demand from users show that it actually is an issue. If this was the case, then I could absolutely imagine having an alternate implementation. |
Came here wondering about BiDi and similar shaping features in RmlUi. (Eg Arabaic and CJK scripts) From other research, HarfBuzz is essentially an extension to FreeType (was originally the same code-base) but for full text-shaping you would also need to consider using Pango which is unfortunately large and depends on GLib. (There's also FreeBiDi in there as a dependency, I think). Avoiding Pango dependency would be nice for those reasons but means you have to separate text into runs of consistent style, direction, font, etc before handing them to HarfBuzz. |
We now have initial support for harfbuzz in one of the samples, see #568. There are surely improvements to be made, and in the end we would like to move this font engine directly into core as an optional component. However, I am closing this issue, further improvements related to this topic should be continued in new and more focused issues. |
I added NotoSansArabic-Regular.ttf as a fallback font to see how RmlUi rendered Arabic:
Is internationalization a priority for this project?
The text was updated successfully, but these errors were encountered: