maplibre-gl-js
maplibre-gl-js copied to clipboard
Fall back to local glyph rendering if glyph PBF is unavailable
If a glyph PBF is unavailable, try to fall back to local glyph rendering, and keep rendering the map without crashing.
Fixes #3302 and fixes #4563.
Launch Checklist
- [x] Confirm your changes do not include backports from Mapbox projects (unless with compliant license) - if you are not sure about this, please ask!
- [x] Briefly describe the changes in this PR.
- [x] Link to related issues.
- [x] Include before/after visuals or gifs if this PR includes visual changes.
- [x] Write tests for all new functionality.
- [ ] Document any changes to public APIs.
- [ ] Post benchmark scores.
- [x] Add an entry to
CHANGELOG.mdunder the## mainsection.
Codecov Report
:white_check_mark: All modified and coverable lines are covered by tests.
:white_check_mark: Project coverage is 96.29%. Comparing base (897cff1) to head (36c323a).
:warning: Report is 3 commits behind head on main.
Additional details and impacted files
@@ Coverage Diff @@
## main #4564 +/- ##
==========================================
+ Coverage 96.28% 96.29% +0.01%
==========================================
Files 293 293
Lines 35437 35475 +38
Branches 8684 8688 +4
==========================================
+ Hits 34119 34160 +41
+ Misses 1318 1315 -3
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
:rocket: New features to boost your workflow:
- :package: JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
Looks good, thanks!
Ping. Any plans for merging this?
I think @1ec5 mentioned there is work that he is planning to do before this can be merged as far as I remember...
Yes, the to-do list looks like:
- [x] Relax the requirement for
glyphs - [x] Go back to only using
localIdeographFontFamilyfor ideographic ranges - [x] Try to match
text-fontto a local font (pass in the property value to TinySDF as thefontFamily)
These changes are straightforward but may require a proposal to change the style spec. I haven’t gotten around to that part yet.
@1ec5 any updates on this? I would like to clean up some of the PR that are open for some time...
There should (also) be an API for this in my opinion.
I don't want people to author styles without a glyphs property (that won't function with Native for the forseeable future, and will be a hassle to use in any case) just to take advantage of local font rendering.
@1ec5 where are we with regards to this PR?
We merged maplibre/maplibre-style-spec#1068, which unblocks this PR, so the rest is pretty straightforward. However, maplibre/maplibre-style-spec#1204 just landed too – would it be necessary to implement that feature within the scope of this PR, or can we stage it one font selection mechanism at a time?
I don't think it should be part of this PR. The issue is tracked here: https://github.com/maplibre/maplibre-gl-js/issues/50 And can (and should probably) be solved in a diff PR.
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
| Diff | Package | Supply Chain Security |
Vulnerability | Quality | Maintenance | License |
|---|---|---|---|---|---|---|
| @maplibre/maplibre-gl-style-spec@24.3.0 ⏵ 24.3.1 |
Sorry for the huge number of comments on such a short block of code and not so drastic changes, but it's already hard to understand it, so I want to make it a little bit better from readability aspect. I hope you'll forgive me :-)
I understand and appreciate it! It was already spaghetti code before I added at least two other variables to the mix. #4550 and 1ec5/maplibre-gl-js#1 will result in even more churn in this area, so I may not be as aggressive in refactoring this code as I normally would be.
I've added some last minor comments and this can be merged afterward. Thanks for all the work on this!