https://github.com/rinigus/mapbox-gl-fonts
Conversion of fonts into Mapbox GL supported glyphs
https://github.com/rinigus/mapbox-gl-fonts
Last synced: 8 months ago
JSON representation
Conversion of fonts into Mapbox GL supported glyphs
- Host: GitHub
- URL: https://github.com/rinigus/mapbox-gl-fonts
- Owner: rinigus
- License: gpl-3.0
- Created: 2017-12-09T13:24:44.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2022-07-24T15:30:35.000Z (almost 4 years ago)
- Last Synced: 2025-04-02T11:36:38.024Z (about 1 year ago)
- Language: Python
- Size: 17.6 KB
- Stars: 4
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Scripts for importing fonts into SQLite database with Mapbox GL-supported glyphs
In this project, the scripts are developed for importing fonts (TTF and OTF) into SQLite database in Mapbox GL-supported format.
The scripts are developed targeting support for [OSM Scout Server](https://github.com/rinigus/osmscout-server). The fonts are imported
as a group of fonts that is merged into a single font stack. The resulting merged font stack gets the glyphs from the provided list
of fonts by picking the glyph from the first font that has it. As a result, the fonts that are distributed as a set of fonts can be merged
and easily used in Mapbox GL styles.
## Requirements
As a requirement, font import requires
[build_pbf_glyphs](https://github.com/stadiamaps/build_pbf_glyphs). Install it
with
```
cargo install build_pbf_glyphs
```
## Prepare PBF reader
The fonts are imported using `fontimport.py` script. The script requires Protocol Buffers Python representation of the PBFs used by Mapbox GL to
define the font stacks. To generate Python code, run
```
(cd proto && protoc --python_out=. glyphs.proto)
```
## Getting fonts and import
At present, scripts are written for fetching Open Sans and Noto fonts. To fetch and unpack fonts, run `getfonts.sh`.
To import these fonts into SQLite, run `import.sh`.