Support geographically-sized text symbols #9208
Closed
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 #7163
Fixes #7563
This PR adds support for text layers that scale with the map by removing the restriction on text-size for
source
andcomposite
expressions.The main problem is that text-size has been given the same precision as icon-size, even though the former is in units of pixels and the latter is in units of relative size. Integer precision is fine for pixel units, but terrible for icon-size units. To support icon-size, these values are scaled by
SIZE_PACK_FACTOR
(previously 256 but recently reduced to 128), packed in to a UInt16, and then divided bySIZE_PACK_FACTOR
in the shader. This change skips that upscaling and downscaling when we're dealing with text-size instead of icon-size, significantly increasing the upper range of text-size without reducing the precision of icon-size.Here are some JSFiddles to demonstrate:
Using v1.6.1: Note that no text is rendered and a console warning says
Value for "text-size" is >= 255. Reduce your "text-size".
Using this fork: Note that you as you zoom, the text scales with the map.
@mapbox/studio
and/or@mapbox/map-design-team
if this PR includes style spec or visual changes@mapbox/gl-native
if this PR includes shader changes or needs a native portmapbox-gl-js
changelog:<changelog>Adds support for geographically-sized text</changelog>