Load, parse, and cache MapLibre glyph SDFs, and construct glyph atlases
npm install sdf-managerLoad, parse, and cache MapLibre glyph SDFs, and construct glyph atlases
The code follows the same strategy as the glyph management in
MapLibre-GL.
sdf-manager simply pulls out this part of the code and modularizes it.
javascript
import * as sdfManager from 'sdf-manager';
`Syntax
`javascript
const getGlyphs = sdfManager.initGetter(urlTemplate, key);
`The
urlTemplate must follow the pattern described in the
MapLibre documentation.
The key is your API key to access the SDF server.The returned
getGlyphs function has the following syntax:
`javascript
const atlas = getGlyphs(fonts);
`
where fonts is a dictionary of fonts and associated character codes, with
the following structure:
`javascript
const fonts = { font1: [code1, code2, ...], font2: [...], ... };
`Examples of the returned
atlas`, and how it can be used, can be found in this