-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement 'images in labels' feature (#8904)
* Set 'isSDF' flag per icon quad * Simplify formatted expression parsing Allow omission of empty section options objects. This enables following syntax ["format", "first section\n", "second section\n", ["image", "smiley"], "third section"] * Add Image to Format expression Image could be part of Format expression and evaluated ResolvedImage is a optional member of evaluated Formatted type. * Add formatted text's image section image to deps * Add images to TaggedString's section * Pass images to text shaping * Use {text|icon}-size vertex attribute field to encode 'isSDF' flag This change uses higher bit to indicate whether quad's vertices belong to a quad whose texture should be rasterized using SDF function. Size scaling factor is changed from 256 to 128, which reduces resolution a bit, however, as the scaling result is now being rounded, final result should be the same. * Shape images in labels * Draw color icons and sdf text with one program / draw call * Align images and scaled glyphs in vertical layout * Allow image breaking * Update render test expectations for tests using font-scale Fixes misaligned text boxes * Update format expression tests to account for image sections * Update quads unit test * Update shaping unit test * Update unit test for format expression API * Fix linter errors * Don't scale images in labels with text size * Basic render test * Multiline test * Vertical layout with images * Line placement test * Expression test for image section * Format expression unit and API test * Shaping unit test * Add benchmarks for symbol layer with icons * Use explicit 'symbol_text_and_icon' shader name instead of 'symbol' Add is_text back, in follow-up pr shader can be renamed to sdf and raster, and can be used to draw sdf and raster icons in one pass. * Don't use mod for unpacking flag * Use linear interpolation for images in label for zoom dependent text size * Add back glyphMap to shaping Glyph map is used as a fallback whenever glyph is missing in glyph positions, e.g., space character that may not be backed by a texture, yet, has a glyph metrics. * Render test for constant text-size * Render test for image justification * Take into account image padding and image pixel ratio * Add render test to verify that linear filtering is used Test that linear filtering is used for icons in text when text-size is zoom-dependent. * Fix size of images in text at integer zoom levels * Update shaping unit test and remove unused parameter from shapeLines
- Loading branch information
1 parent
c9bb0f3
commit 12a331b
Showing
59 changed files
with
3,773 additions
and
1,041 deletions.
There are no files selected for viewing
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
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
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
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
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
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
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
Oops, something went wrong.