Skip to content

Commit

Permalink
add doc about font
Browse files Browse the repository at this point in the history
  • Loading branch information
sharkAndshark committed Oct 24, 2023
1 parent f229108 commit 35c69c7
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/src/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
- [MBTiles and PMTiles File Sources](sources-files.md)
- [Composite Sources](sources-composite.md)
- [Sprite Sources](sources-sprites.md)
- [Font Sources](sources-fonts.md)
- [Usage and Endpoint API](using.md)
- [Using with MapLibre](using-with-maplibre.md)
- [Using with Leaflet](using-with-leaflet.md)
Expand Down
5 changes: 5 additions & 0 deletions docs/src/config-file.md
Original file line number Diff line number Diff line change
Expand Up @@ -183,4 +183,9 @@ sprites:
sources:
# SVG images in this directory will be published as a "my_sprites" sprite source
my_sprites: /path/to/some_dir
# Font configuration
fonts:
# otf, ttf, ttc files will be find recursively
- /path/to/font_dir1
- /path/to/font_dir2
```
3 changes: 3 additions & 0 deletions docs/src/run-with-cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ Options:
-s, --sprite <SPRITE>
Export a directory with SVG files as a sprite source. Can be specified multiple times

-f, --font <FONT>
Export a directory with font files as a font source. Can be specified multiple times

-k, --keep-alive <KEEP_ALIVE>
Connection keep alive timeout. [DEFAULT: 75]

Expand Down
29 changes: 29 additions & 0 deletions docs/src/sources-fonts.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
## Font Sources

Martin can serve font assests(`otf`, `ttf`, `ttc`) for map rendering, and there is no need to supply a large number of small pre-generated font protobuf files. Martin can generate them dynamically on the fly based on your request.

## API
You can request font protobuf of single or combination of fonts.

||API|Demo|
|----|----|----|
|Single|/font/{fontstack}/{start}-{end}|http://127.0.0.1:3000/font/Overpass Mono Bold/0-255|
|Combination|/font/{fontstack1},{fontstack2},{fontstack_n}/{start}-{end}|http://127.0.0.1:3000/font/Overpass Mono Bold,Overpass Mono Light/0-255|

## Configuring from CLI
A font directory can be configured from the [CLI](run-with-cli.md) with the `--font` flag. The flag can be used multiple times to configure multiple font directories.

```shell
martin --font /path/to/font_dir1 --font /path/to/font_dir2
```

## Configuring from Config File

A font directory can be configured from the config file with the `fonts` key.

```yaml
# Fonts configuration
fonts:
- /path/to/fonts_dir1
- /path/to/fonts_dir2
```

0 comments on commit 35c69c7

Please sign in to comment.