elastic / maki

POI Icon Set
Creative Commons Zero v1.0 Universal
4 stars 2 forks source link

Sdf icons #3

Closed nickpeihl closed 5 years ago

nickpeihl commented 5 years ago

Fixes https://github.com/elastic/kibana/issues/39715

This automatically builds PNG spritesheets of Maki icons with Signed Distance Fields (SDF) for better sizing, coloring, and rotation in WebGL maps.

SVGs are scaled to generate three sizes of spritesheets. These are generated at build time and added to the repo.

sprite@1 - standard size sprite@2 - retina sprite@4 - ultra-hd

Each spritesheet comes with a .json file which maps the icon ids to the location in the spritesheet. Images from the spritesheet can be added to a mapbox-gl map by iteratively running the map.addImage method similar to these mapbox-gl-js internals.

Implementation note: You may need to set options.sdf = true in the map.addImage function.

SDF icon generation requires changes to Mapbox's fontnik and spritezero libraries:

See this POC showing one way we could load the spritesheet icons based on mapbox-gl-js internals.

nyurik commented 5 years ago

As mentioned on Slack, it would be great if we can avoid checking in the build artifacts, and make it part of npm publish to push them in?