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

RTL support #220

Closed
majdal opened this issue Jul 22, 2021 · 10 comments
Closed

RTL support #220

majdal opened this issue Jul 22, 2021 · 10 comments
Labels

Comments

@majdal
Copy link

majdal commented Jul 22, 2021

Motivation

Currently, languages that use a right-to-left script, such as Arabic and Hebrew, are rendered left-to-right. This is a classic problem (see notarabic.com), but it would be heartening if the commitment to Libre also included a commitment to inclusive design.

Design Alternatives

Mapbox-gl-rtl-text has an (incomplete) fix to this issue. It works well for the default fonts, but breaks when using custom fonts.

I don't have the technical skills to think of specific implementation solutions, but I'm happy to discuss and help conceptualizing it with whomever would be able to help.

@lseelenbinder
Copy link
Member

I would definitely like to see the RTL plugin be included by default (or some other variant), but I haven't looked into it deeper.

Could you elaborate about how it breaks?

@HarelM
Copy link
Collaborator

HarelM commented Jul 22, 2021

I'm using Hebrew for a long time with mapbox and now with maplibre.
I admit I'm not using custom fonts, but I'm not sure what that means exactly...
The RTL plugin is a port of intl, I think, and I'm not even sure how easy it is to change it.
Please provide a minimal example using jsbin/codepen/stackblitz so we can better understand what the issue is.

As a side note, I don't think the first paragraph is in place, especially without checking who's maintaining this library first... As a Hebrew speaker, code writer and site owner I can't say I wasn't offended a bit... :-(

@majdal
Copy link
Author

majdal commented Jul 22, 2021

Thanks for the quick responses! It's a very heartening demonstration of the maintainers' committment to inclusive design.

Here's a quick very basic example: https://codepen.io/majdal/pen/jOmGjVq

All the place labels are rendered left to right. For example, Damascus, which should be written as دمشق is rendered as ق ش د م, making it basically completely illegible. The screenshot below shows it.

Fixing this is already a win. As for the custom fonts, I'll have to dig a bit further into how Mapbox Studio serves the fonts, because previously I had only used it through the GUI. It seems like I might have to play with the glyphs style specification? But to demonstrate, I'm using the libre font Cairo to render the labels in the second screenshot (from Mapbox Studio). The word القدس (Jerusalem) has three segments in Arabic. The first and last segment are rendered in the default font, while the middle segment is rendered with the Cairo custom font.

broken rendering
custom font

P.S. Funnily enough, Github is rendering the above two paragraphs that contain bidirectional content as right-to-left, even though they're mostly left-to-right. A small window into what the web feels like to RTL language speakers 😅

@HarelM
Copy link
Collaborator

HarelM commented Jul 23, 2021

I haven't seen the usage of mapbox-gl-rtl-text
In the above example.
While I agree this is not optimal that this is not part of this library by default, there's still an easy fix to the problem above...
Please update the codepen and let me know if there's other issues you encounter.

@HarelM
Copy link
Collaborator

HarelM commented Aug 29, 2021

Any updates on this? Can I close this issue?

@majdal
Copy link
Author

majdal commented Sep 10, 2021 via email

@github-actions
Copy link
Contributor

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days.

@github-actions github-actions bot added the stale label Nov 10, 2021
@github-actions
Copy link
Contributor

This issue was closed because it has been stalled for 30 days with no activity.

@yeegor-restrata
Copy link

@HarelM this issue still persists. Hebrew text is rendered in a wrong direction, even with the default font!
See an example here: https://jsfiddle.net/a1er8uhy/1/
Greece, for example, should be יוון, but it's rendered as ןווי.

@HarelM
Copy link
Collaborator

HarelM commented Feb 23, 2022

@yeegor-restrata not reading the documentation is the issue here, not the code, sorry... You need to add the RTL plugin and use a font with Hebrew characters.
Here's a live example of this working, I assure you Hebrew is supported.
https://israelhiking.osm.org.il/

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

No branches or pull requests

4 participants