Skip to content
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

Add support for SDF icons #77

Merged
merged 6 commits into from
Dec 4, 2023
Merged

Add support for SDF icons #77

merged 6 commits into from
Dec 4, 2023

Conversation

flother
Copy link
Owner

@flother flother commented Dec 1, 2023

See #58.

Mapbox and MapLibre both support SDF icons, sprites that store a signed distance field in their alpha channel. They're not well documented (Mapbox calls them re-colourable images and MapLibre doesn't really mention them) and they're pretty much abandoned as an idea (see the conversation in mapbox-gl-style-spec#444). But nevertheless both style specs support them and so Spreet should be able to generate SDF spritesheets.

Stadia Maps's sdf_glyph_renderer crate supports signed distance field generation and so we can use that to do the heavy lifting. Although in theory a single spritesheet can mix-and-match SDF sprites with non-SDF sprites, in practice spritesheets tend to include one or the other but not both. And so for now I think it's fine for support to be all-or-nothing: a spritesheet can have all SDF icons, or no SDF icons. If there's demand in the future, we can support mixing.

@flother flother self-assigned this Dec 1, 2023
Missing tests, plus the calculation of the alpha value isn't quite right
yet.
@flother flother marked this pull request as ready for review December 4, 2023 20:59
@flother flother merged commit 51e9b00 into master Dec 4, 2023
4 checks passed
@flother flother deleted the sdf-icons branch December 4, 2023 21:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant