-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Port high resolution local SDFs #10298
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ChrisLoer
added
feature 🍏
GL native → GL JS
For feature parity with Mapbox Maps SDK on a native platform
labels
Jan 18, 2021
10 tasks
mourner
approved these changes
Jan 22, 2021
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great! Added a few nits. Perhaps also worth adding some code comments around heuristics like baselineAdjustment
.
Don't double-generate for glyphs with different fontstack but same local font. Align baselines for glyphs generated with different local fonts. Update tests.
7 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Launch Checklist
This PR brings gl-js to parity with gl-native by porting the 2x resolution local glyph generation. It includes:
TextMetrics
and support for local generation of non-ideographic glyphs usinglocalFontFamily
map option. (Previously in PR Add 'localFontFamily' option to support rendering of all glyphs. #10267: I've rolled it into this PR because both PRs depend on the same TinySDF changes and I've been testing them together).The visual improvement is noticeable on high DPI screens, and can also be seen easily in large labels:
Before
After
For default settings, these changes have negligible performance impact for maps without heavy CJK-use. For CJK maps, the main impact is at load time (generating SDFs for the first time), although there is a small ongoing hit from loading larger glyph atlases (SDF generation is also an ongoing cost once the map is loaded, but the rate of new glyph generation drops off pretty quickly once a set of common characters are loaded). One option we have for ameliorating the load time performance hit is to do SDF generation on the workers. However, if we can get away with it, I'd like to avoid that complexity. For performance testing, I used benchmap-js with a Japanese-language style that rendered three cities at z8, z12, and z16. The main results were:
The 16% full-load slow down is similar to the performance hit we accepted on the "Tokyo All Local Glyphs" perf benchmark on the native side.
@mapbox/map-design-team
@mapbox/static-apis
if this PR includes style spec API or visual changes@mapbox/gl-native
if this PR includes shader changes or needs a native portmapbox-gl-js
changelog:cc @mourner @zmiao @asheemmamoowala @alexshalamov @YoshiYazawa @tsuz @ansis