Mapbox to CSS Font
Utility to convert Mapbox GL Style font names to CSS compatible font definitions.
API
parseFont
Utility to convert Mapbox GL Style font names to CSS font definitions.
Parameters
font
(string Mapbox GL Style font name, e.g. 'Open Sans Regular'
.
Returns Array Parts of the CSS font definition, i.e. [font-style font-weight font-size font-family]
. The size will be 16
. Call
asCss
with this array and a size to get a CSS font definition string.
asCss
Applies a size to an array of CSS font definition parts and returns a CSS font definition string.
Parameters
-
cssData
Array Parts of the CSS font definition, i.e. [font-style font-weight font-size font-family]
.
-
size
number Font size in pixels.
Returns string CSS font definition, e.g. 'normal 400 16px Open Sans'
.