Fonts API
The Mapbox Fonts API accepts fonts as raw binary data, allows those fonts to be deleted, and generates encoded letters for map renderers. Two types of fonts are supported: TrueType fonts, usually with .ttf
file extensions, and OpenType fonts, with .otf
extensions.
Fonts are managed on a per-account basis. Styles can use any font from the same account.
Retrieve font glyph ranges
While glyph ranges are usually not of interest unless you're building a map renderer, this is the endpoint you can use to access them.
Font glyph ranges are protocol buffer-encoded signed distance fields. They can be used to show fonts at a variety of scales and rotations. One glyph is used at all scales.
Required parameters | Type | Description |
---|---|---|
username | string | The username of the account to which the font belongs. |
font | string | The name of the font. This endpoint supports queries with a maximum of 10 comma-separated font names. |
start | integer | A multiple of 256 between 0 and 65280 . |
end | integer | The number indicated by start , plus 255 . |
Example request: Retrieve font glyph ranges
$ curl "https://api.mapbox.com/fonts/v1/YOUR_MAPBOX_USERNAME/Arial%20Unicode%20MS%20Regular/0-255.pbf?access_token=YOUR_MAPBOX_ACCESS_TOKEN"
Mapbox wrapper libraries help you integrate Mapbox APIs into your existing application. The following SDK supports this endpoint:- Mapbox JavaScript SDKSee the SDK documentation for details and examples of how to use the relevant methods to query this endpoint.
Response: Retrieve font glyph ranges
A successful request will return HTTP 200 Success
. The response body will be a buffer of the glyphs with Content-Type: application/x-protobuf
.
Note: For historical reasons, this API will ignore the 'Accept-Encoding' header, and always encode the response with gzip.