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 right-to-left scripts without requiring plugin #4007

Open
ChrisLoer opened this issue Jan 18, 2017 · 1 comment
Open

Support right-to-left scripts without requiring plugin #4007

ChrisLoer opened this issue Jan 18, 2017 · 1 comment
Assignees
Labels
feature 🍏 GL native → GL JS For feature parity with Mapbox Maps SDK on a native platform

Comments

@ChrisLoer
Copy link
Contributor

We use an Emscripten port of the ICU library to provide support for bidirectional text as well as shaping for Arabic text (#3708). However, the Emscripten port ended up being so large that it would nearly double the size of the mapbox-gl.js bundle (see discussion in PR #3758). Because right-to-left support wasn't critical to all of customers, we decided to split the RTL support out into a separate RTL text plugin.

This is a sub-optimal solution: we would prefer for RTL scripts to work out of the box. Possible solutions to this problem include:

  • Accepting the bundle size increase and pulling the Emscriptified code into the main bundle
  • Making and maintaining a (hopefully more lightweight) native JS implementation of both the bidirectional algorithm and arabic shaping. A recent PR to the iD editor points in the direction we could go, but would require significant expansion to implement all of the ICU functionality. We might be able to identify some subset of current ICU functionality that can be dropped.
  • Finding further ways to decrease size of the transpiled ICU code, perhaps by making modifications to Emscripten

The fix for this issue will be tightly coupled to whatever decisions we make as we implement further support for complex text rendering (indic scripts, ligatures, kerning, etc.). The current plan on mapbox-gl-native is to use Harfbuzz for client-side text shaping (mapbox/mapbox-gl-native#7528). Directly porting those changes would require us to either double down on the Emscripten strategy or greatly expand the scope of any direct C++->JS port.

cc @1ec5 @lucaswoj @pveugen

@ChrisLoer ChrisLoer added feature 🍏 GL native → GL JS For feature parity with Mapbox Maps SDK on a native platform labels Jan 18, 2017
@ChrisLoer ChrisLoer self-assigned this Jan 18, 2017
@ChrisLoer
Copy link
Contributor Author

#4847 brings the size of the plugin down from 396KB to 273KB: not enough to bundle it in, but going in the right direction. If/when we start using Web Assembly, we could get this down even further to around ~125KB.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature 🍏 GL native → GL JS For feature parity with Mapbox Maps SDK on a native platform
Projects
None yet
Development

No branches or pull requests

1 participant