JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 211300
  • Score
    100M100P100Q174017F
  • License BSD-2-Clause

Utility to convert Mapbox GL Style font names to CSS font definitions

Package Exports

  • mapbox-to-css-font

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (mapbox-to-css-font) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

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'.