From 35c69c79e1a2d75fedc2a54271679c81e887d9a1 Mon Sep 17 00:00:00 2001 From: Lucas Date: Tue, 24 Oct 2023 14:07:54 +0800 Subject: [PATCH] add doc about font --- docs/src/SUMMARY.md | 1 + docs/src/config-file.md | 5 +++++ docs/src/run-with-cli.md | 3 +++ docs/src/sources-fonts.md | 29 +++++++++++++++++++++++++++++ 4 files changed, 38 insertions(+) create mode 100644 docs/src/sources-fonts.md diff --git a/docs/src/SUMMARY.md b/docs/src/SUMMARY.md index c306389b3..9f4cd97e5 100644 --- a/docs/src/SUMMARY.md +++ b/docs/src/SUMMARY.md @@ -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) diff --git a/docs/src/config-file.md b/docs/src/config-file.md index deaeba64d..b941e9254 100644 --- a/docs/src/config-file.md +++ b/docs/src/config-file.md @@ -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 ``` diff --git a/docs/src/run-with-cli.md b/docs/src/run-with-cli.md index c51d2a139..69f9c25b9 100644 --- a/docs/src/run-with-cli.md +++ b/docs/src/run-with-cli.md @@ -19,6 +19,9 @@ Options: -s, --sprite Export a directory with SVG files as a sprite source. Can be specified multiple times + -f, --font + Export a directory with font files as a font source. Can be specified multiple times + -k, --keep-alive Connection keep alive timeout. [DEFAULT: 75] diff --git a/docs/src/sources-fonts.md b/docs/src/sources-fonts.md new file mode 100644 index 000000000..5fd1dd8a5 --- /dev/null +++ b/docs/src/sources-fonts.md @@ -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 +``` \ No newline at end of file