Don't cache server requested glyphs in the local glyph ranges #8657
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.
Fixes #8653.
Font glyphs from the server are requested in packed in ranges of 256 characters. In some rare cases a single range may contain characters that can be locally generated (using tinySDF) and that need to be fetched from the server.
The issue described in #8653 stems from a character from such an overlapping range causing the remote glyphs being cached for even those characters that should be locally generated. This would be a non-issue if both local generation and the server request were resolving to the same font.
The fix is to check each character in the fetched range and skip it if it is should be generated locally. An additional improvement in this PR is to cache the locally generated glyphs so that subsequent tiles don't need to re-generate them.
I also found a bug in
Map#setStyle
while debugging this issue that uses the wrongdefault
font family for local glyph generation. It should use the value resolved in the map constructor.Launch Checklist
cc @chloekraw @tmpsantos