mapbox-to-css-font

WebJar for mapbox-to-css-font

License

License

BSD 2-Clause
GroupId

GroupId

org.webjars.npm
ArtifactId

ArtifactId

mapbox-to-css-font
Last Version

Last Version

2.4.0
Release Date

Release Date

Type

Type

jar
Description

Description

mapbox-to-css-font
WebJar for mapbox-to-css-font
Project URL

Project URL

https://www.webjars.org
Source Code Management

Source Code Management

https://github.com/openlayers/mapbox-to-css-font

Download mapbox-to-css-font

How to add to project

<!-- https://jarcasting.com/artifacts/org.webjars.npm/mapbox-to-css-font/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>mapbox-to-css-font</artifactId>
    <version>2.4.0</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/mapbox-to-css-font/
implementation 'org.webjars.npm:mapbox-to-css-font:2.4.0'
// https://jarcasting.com/artifacts/org.webjars.npm/mapbox-to-css-font/
implementation ("org.webjars.npm:mapbox-to-css-font:2.4.0")
'org.webjars.npm:mapbox-to-css-font:jar:2.4.0'
<dependency org="org.webjars.npm" name="mapbox-to-css-font" rev="2.4.0">
  <artifact name="mapbox-to-css-font" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='mapbox-to-css-font', version='2.4.0')
)
libraryDependencies += "org.webjars.npm" % "mapbox-to-css-font" % "2.4.0"
[org.webjars.npm/mapbox-to-css-font "2.4.0"]

Dependencies

There are no dependencies for this project. It is a standalone project that does not depend on any other jars.

Project Modules

There are no modules declared in this project.

Mapbox to CSS Font

Utility to convert Mapbox GL Style fontstacks or fonts names to CSS compatible font definitions.

For fontstacks, the style and weight of the primary font (first font in the fontstack) will also be used for the fallback fonts.

The "Klokantech Noto Sans" font is recognized and returned as "Noto Sans", so it can be loaded as web font from Google fonts.

Usage

var parseFont = require('mapbox-to-css-font');
parseFont('Open Sans Regular', 16, 1.2);
// returns 'normal 400 16px/1.2 "Open Sans"'

API

Parameters

  • fonts string|Array<string> Mapbox GL Style fontstack or single font, e.g. ['Open Sans Regular', 'Arial Unicode MS Regular'] or 'Open Sans Regular'.

  • size number Font size in pixels.

  • lineHeight string|number Line height as css line-height. Optional.

Returns string CSS font definition, e.g. 'normal 400 16px/1.2 "Open Sans"'.

org.webjars.npm

OpenLayers

Versions

Version
2.4.0