maplibre-fonts-glyphs

为 MapLibre GL JS 和 MapLibre Native 配置字体与字形:包括样式中的 glyphs URL、自托管或生成字体 PBF 文件、在 GL JS 中的本地字体回退机制(当省略 glyphs 或获取字形失败时)、MapLibre Native 的 font-faces 属性,以及对 Noto 字体、CJK(中日韩)、RTL(从右到左)和天城文等非拉丁文字脚本的处理。适用于文本标签未按预期字体渲染、搭建字形服务器、选择自托管或生成 PBF 方案,以及处理非拉丁文字脚本的场景。

仓库最近推送
GitHub Stars
167
Forks
10
Issues / PRs
24

安装方式

先用 Prompt 核对来源与依赖。也可下载安装包。

用 AI 助手安装

复制提示词,让助手先核对固定版本和依赖。

查看 Prompt收起 Prompt
先检查当前 Agent 是否已安装 SkillPI Skill Finder。如果尚未安装,请按官方仓库的说明安装并启用:https://github.com/Findskills/skillpi。然后使用 Skill Finder 打开此 SkillPI 详情页并定位 "maplibre-fonts-glyphs":https://skillpi.com/zh/skills/deepskill-eba9c6e10bde0991938301753baa462059044bf0998f2e17a28b52b838c7a0a8。安装前核对上游来源和版本:https://github.com/maplibre/maplibre-agent-skills。来源不一致时停止并说明差异。核对通过后,用 Skill Finder 安装目标 Skill,并报告安装路径和来源版本。

来源与配置

github.com

配置方式待核实

请查看原始来源中的适用工具、依赖和权限要求。

安装实测待补充

为 MapLibre GL JS 和 MapLibre Native 配置字体与字形:包括样式中的 glyphs URL、自托管或生成字体 PBF 文件、在 GL JS 中的本地字体回退机制(当省略 glyphs 或获取字形失败时)、MapLibre Native 的 font-faces 属性,以及对 Noto 字体、CJK(中日韩)、RTL(从右到左)和天城文等非拉丁文字脚本的处理。适用于文本标签未按预期字体渲染、搭建字形服务器、选择自托管或生成 PBF 方案,以及处理非拉丁文字脚本的场景。

0 下载

介绍来源: third_party · maplibre · 0.0.1 参考来源

SkillPi 解读

能完成的任务
翻译待完成,请参阅来源文档。
适合谁
翻译待完成,请参阅来源文档。
实测状态
未测试

文件浏览

在原站浏览文件 ↗

原始 SKILL.md

打开原文 ↗
Frontmatter
name: maplibre-fonts-glyphs
description: Configuring fonts and glyphs for MapLibre GL JS and MapLibre Native — the style's `glyphs` URL, self-hosting or generating font PBFs, the GL JS local-font fallback (omitted `glyphs` or a failed glyph fetch), MapLibre Native's `font-faces` property, and Noto/CJK/RTL/Devanagari script handling. Use when text labels aren't rendering in the intended font, setting up a glyphs server, choosing between self-hosting and generating font PBFs, or handling non-Latin scripts.
status: provisional

MapLibre Fonts and Glyphs

MapLibre doesn't render text with fonts installed on the machine by default. It fetches precomputed glyph images from a server, or (GL JS, since 5.11.0) falls back to local/system fonts. This skill covers where glyphs come from, the GL JS local-font fallback, MapLibre Native's separate font-faces mechanism, and non-Latin script support. For font sizing, weight, and other visual-hierarchy decisions, see maplibre-cartography.

When to Use This Skill

  • Text labels aren't rendering, or render in the wrong font
  • Setting up a glyphs URL for a custom or self-hosted style
  • Deciding whether to self-host existing font PBFs or generate your own from a TTF/OTF
  • Rendering non-Latin scripts (CJK, Arabic, Hebrew, Devanagari, and others)
  • Rendering fonts locally/offline without a glyphs server, on GL JS or Native

MapLibre renders text using SDF glyphs

MapLibre renders text using SDF (signed-distance field) glyphs — precomputed font files that scale cleanly at any zoom or screen density, served from a URL matching the style's glyphs field. In GL JS ≥ 5.11.0 (PR #4564), an unresolvable glyphs situation is no longer fatal: MapLibre renders text locally via TinySDF instead, treating text-font as a cascading list of local/web font names. This covers two cases:

  • glyphs omitted entirely. A first-class local-fonts mode, not just error recovery. Every text-font name is resolved as a web font (loaded with @font-face or document.fonts.load()) or a system font, the same way a browser resolves a CSS font-family list. No PBF generation, no glyph server. See the local fonts and web fonts examples.
  • glyphs is set but a specific glyph PBF fails to load (wrong font name, 404, etc.). The same local-render path fires per glyph range instead of failing the tile, logging Unable to load glyph range ... Rendering codepoint U+... locally instead. Treat this as cosmetic, not correctness: the text renders in a generic local/system font that varies by OS/browser, but doesn't go invisible or break the layer.

The PR author's own caveat still holds: this is GL JS only. The PR text declines to "encourage style authors to rely on non-CJK local text rendering yet," since Native still needs matching Android and iOS implementations for interoperability. A style that must look the same on GL JS and Native should keep serving glyphs explicitly instead of relying on the fallback.

Native's equivalent is a different property, not the same one. Native doesn't support omitting glyphs to fall back to local fonts (tracked, still open: maplibre-native#165). Instead it has its own font-faces property (Android ≥ 11.13.0, iOS ≥ 6.18.0 — not implemented in GL JS, gl-js#6637), mapping each text-font name to one or more local font files with an explicit Unicode range you specify yourself. Same goal as GL JS's fallback — offline rendering without a glyph server — but manual instead of automatic: you get exact control over which file covers which codepoints, at the cost of working out those ranges yourself. Don't port font-faces config to a GL JS style, or the GL JS omit-glyphs pattern to Native — the two SDKs solve local fonts with unrelated mechanisms today.

Setting the glyphs URL

The style's glyphs field is a URL template ending in /{fontstack}/{range}.pbf (e.g. https://demotiles.maplibre.org/font/{fontstack}/{range}.pbf), where {fontstack} is the comma-joined text-font list and {range} a Unicode range — full mechanics: style spec — glyphs. text-font is itself a fallback list — see Noto for global maps below.

Font options

Source Fonts available Notes
demotiles.maplibre.org/font Noto Sans (Latin, Arabic, CJK, etc.), Noto Sans Bold, Italic Free, publicly hosted; good for prototyping
OpenMapTiles fonts.openmaptiles.org Klokantech Noto Sans family Matched to OMT schema styles
Self-hosted, existing font Reuse prebuilt PBFs (openmaptiles/fonts, UNDP-Data/fonts, or your current server's tree) Full control; no generation needed for standard fonts
Self-hosted, custom font Generate PBFs from your own TTF/OTF Only needed when no prebuilt PBF set exists for the font

For standard fonts (Noto Sans, Open Sans, Roboto, and similar), you don't need to generate anything. The simplest path is copying the {fontstack}/{range}.pbf tree a glyph server already serves (e.g. the one your style currently points at) onto your own origin. openmaptiles/fonts and UNDP-Data/fonts package the common standard fonts as glyph PBFs you can build or pull. Both also run hosted endpoints of their own — third-party servers, so skip those if self-hosting is the point. Point the style's glyphs field at your own URL template; the font names in your text-font arrays must exactly match the served font-stack folder names.

Generating glyphs from a TTF/OTF is a separate, heavier task — only needed for a custom or brand font with no existing PBF set. Use Font Maker or fontnik to produce the .pbf files, then serve and reference them the same way as above.

Noto for global maps

Noto ("no tofu") is Google's open-source family built for near-universal Unicode coverage: Noto Sans covers Latin/Greek/Cyrillic, and script-specific fonts (Noto Sans Arabic, Noto Sans Devanagari, Noto Sans Thai, the region-specific Noto Sans CJK SC/TC/JP/KR) extend it. How you handle non-Latin text depends on the script, and CJK is the case people most often get wrong.

CJK (Chinese, Japanese, Korean) — rendered locally by default; do not serve CJK glyph PBFs. GL JS's localIdeographFontFamily map option defaults to 'sans-serif', so CJK characters are generated on-device (TinySDF), and text-font is ignored for them (except the weight keyword). This exists because CJK text has poor locality across Unicode ranges: a single tile can otherwise trigger dozens of large glyph requests.[2] Leave it on; optionally point it at a nicer on-device CJK font. Setting localIdeographFontFamily: false restores served glyphs for CJK, which is much slower — only do it if you specifically need the served font's shapes.

const map = new maplibregl.Map({
  // ...
  localIdeographFontFamily: '"Noto Sans CJK SC", sans-serif' // optional; default is 'sans-serif'
});

Other non-Latin scripts (Arabic, Hebrew, Thai, …) — need real glyphs. localIdeographFontFamily does not apply here. Add the relevant Noto script font to the style layer's text-font fallback list and serve its glyph PBFs (or rely on the GL JS ≥ 5.11.0 local fallback, which is environment-dependent — see the top of this skill). Font names must match those the glyph server knows.

Devanagari, Khmer, and other scripts requiring ligatures/reordering — glyphs alone will not fix this. MapLibre maps each Unicode codepoint to one glyph with no shaping engine (no HarfBuzz/Raqm), so it cannot form the conjuncts and reordering these scripts require — serving the correct font's PBFs will not produce correct-looking text. There is currently no configuration fix; this is a known architectural limitation.[3]

{ "text-font": ["Noto Sans Regular", "Noto Sans Devanagari Regular"] }

Arabic and Hebrew additionally need the RTL text plugin for correct right-to-left shaping and ordering — glyph coverage alone is not enough. GL JS does not handle RTL by default[1]:

import { setRTLTextPlugin } from 'maplibre-gl';
setRTLTextPlugin('https://unpkg.com/maplibre-gl/dist/maplibre-gl-rtl-text.js', null, true);

Call this before initializing the map.

Related Skills

  • maplibre-cartography — Font size, weight, and letter-spacing for visual hierarchy; sprites and icons.
  • maplibre-source-wiring — Where glyphs and sprite fit into a style's other components; CORS for self-hosted assets.

References

  1. setRTLTextPlugin (MapLibre GL JS API) — required for correct Arabic/Hebrew shaping
  2. Use locally generated ideographs (MapLibre GL JS example) — localIdeographFontFamily default and CJK rendering behavior
  3. "About Text Rendering in MapLibre" — SDF glyph architecture, codepoint-to-glyph mapping, and why shaping-dependent scripts (Devanagari, Khmer) don't render correctly

版本历史

  1. v0.3.0 GitHub ↗
    原版更新说明

    ### Added - Claude Code plugin: `/plugin install maplibre-agent-skills --marketplace maplibre/maplibre-agent-skills` installs every skill except the maintainers' eval runbook ([#145](https://github.com/maplibre/maplibre-agent-skills/pull/145)) - `maplibre-sprites-icons` skill, extracted from `maplibre-cartography`: a decision tree for a `Marker`, a sprite, or `addImage`; `sprite` URL forms and several sheets; self-hosting; SVGs through `addImage`; finding a missing icon; route shields (#68) ([#96](https://github.com/maplibre/maplibre-agent-skills/pull/96)) - `maplibre-running-evals` process skill: the step-by-step procedure for running the Promptfoo evals; `evals/README.md` now treats the pinned judge as the default and says when another judge is legitimate ([#81](https://github.com/maplibre/maplibre-agent-skills/pull/81)) ### Changed - skills: `status` moves under `metadata`, as the Agent Skills spec requires, so claude.ai uploads accept them; `maplibre-running-evals` no longer installs with `npx skills add`; `validate:skills` checks front matter against the spec and requires the footer ([#138](https://github.com/maplibre/maplibre-agent-skills/pull/138)) - `maplibre-terrain-patterns` replaced by `maplibre-terrain-rendering` (hillshade, color-relief, contours, 3D terrain and sky, `verified`), with its eval config split along the same seam and cross-references updated; the companion DEM-source content was withdrawn after a probe showed no gap to close ([#84](https://github.com/maplibre/maplibre-agent-skills/pull/84)) - evals: rubrics for `maplibre-mapbox-migration` and `maplibre-pmtiles-patterns` now fail invented APIs; `maplibre-mapbox-migration` gains the Mapbox v2 → MapLibre API mapping, and both skills move to `verified` ([#85](https://github.com/maplibre/maplibre-agent-skills/pull/85)) ### Fixed - `maplibre-mapbox-migration`, `maplibre-pmtiles-patterns`, `maplibre-cartography`, `maplibre-tile-sources`: correct a package name that is not on npm, version boundaries, dead links and citations, and how MapLibre GL Leaflet works ([#143](https://github.com/maplibre/maplibre-agent-skills/pull/143)) - `maplibre-v6-migration`: the CDN example uses a namespace import, the `setMissingStyleImageResolver` example calls `map.addImage()` because GL JS ignores the resolver's return value, and the worker note covers 6.13.0's self-contained worker ([#142](https://github.com/maplibre/maplibre-agent-skills/pull/142)) - README: the install section gives the skill folders Cursor, GitHub Copilot, Codex and Claude Code read, and `-a github-copilot` in place of `-a vscode`, which the skills CLI rejects ([#139](https://github.com/maplibre/maplibre-agent-skills/pull/139)) - `maplibre-source-wiring` and `maplibre-tile-sources`: replace "silently omitted" with the console warning GL JS logs for a missing sprite or icon, and `map.hasImage()` ([#104](https://github.com/maplibre/maplibre-agent-skills/pull/104)) - `maplibre-sprites-icons`: gives each OSM Bright sheet's shield badges per network, and its shield test checks those ranges without the judge ([#135](https://github.com/maplibre/maplibre-agent-skills/pull/135)) - `maplibre-source-wiring`: says a `{z}/{x}/{y}` template is not a URL to test by hand, which its TileJSON advice had crowded out ([#120](https://github.com/maplibre/maplibre-agent-skills/pull/120)) - `maplibre-fonts-glyphs`: no longer adds font and glyph advice to answers about layers that draw no text ([#121](https://github.com/maplibre/maplibre-agent-skills/pull/121)) - `maplibre-tile-sources`: back to the narrowed skill #69 verified, which fits the eval provider's request limit again; `maplibre-source-wiring` now says TileJSON 3.0 requires `vector_layers` and names Protomaps' `earth` layer ([#118](https://github.com/maplibre/maplibre-agent-skills/pull/118)) - `maplibre-pmtiles-patterns`: state the GL JS 4.0.0 `addProtocol` handler contract (`{data, cacheControl?, expires?}`, module-level registration), that sources locate tiles with `url` or `tiles` only, and the real `pmtiles` inspection commands ([#92](https://github.com/maplibre/maplibre-agent-skills/pull/92)) ### Internal - dependencies: `promptfoo` 0.125, `markdownlint-cli` 0.50 and `js-yaml` 5.5, with overrides for four transitive packages, so `npm audit` reports nothing ([#144](https://github.com/maplibre/maplibre-agent-skills/pull/144)) - `scripts/setup-hooks.js`: `npm install` outside a git checkout skips the pre-push hook instead of failing ([#140](https://github.com/maplibre/maplibre-agent-skills/pull/140)) - `changelog.yml`: the changelog bot runs `npm run check` before pushing, so an entry that fails it fails the run instead of reaching `main` unchecked ([#109](https://github.com/maplibre/maplibre-agent-skills/pull/109)) - workflows: every job runs the Node version in `.nvmrc`, now 26, with each action on its Node 24 release, and `check.yml` runs the unit tests ([#137](https://github.com/maplibre/maplibre-agent-skills/pull/137)) - `eval.yml`: a config the judge's or the generator's daily limit cuts off waits for the next day instead of failing the run, and a 5xx from either provider is retried ([#134](https://github.com/maplibre/maplibre-agent-skills/pull/134)) - evals: `maplibre-terrain-rendering` test 4 fails an answer that sets a Mapbox-only sky key, which the judge had passed ([#130](https://github.com/maplibre/maplibre-agent-skills/pull/130)) - `eval.yml`: each config's requests are paced to the generator's measured per-minute limit, each config may use what the run's budget has left, and the run log and drift issue name every rate-limit wait ([#131](https://github.com/maplibre/maplibre-agent-skills/pull/131)) - evals: `npm run lint:tripwires` fails on a `not-icontains` that matches the skill its test injects, and the two that did, in `maplibre-terrain-rendering` and `maplibre-v6-migration`, are gone ([#129](https://github.com/maplibre/maplibre-agent-skills/pull/129)) - `eval.yml`: every eval request gets an answer cap that fits the generator's per-minute limit, and the drift check runs daily, grading the configs that have waited longest for a verdict as far as the day's tokens hold ([#126](https://github.com/maplibre/maplibre-agent-skills/pull/126)) - `changelog.yml`: each run records every recently merged PR the changelog lacks, so merging several PRs at once no longer drops entries ([#123](https://github.com/maplibre/maplibre-agent-skills/pull/123)) - evals: answers are graded with U+2011 (non-breaking hyphen) replaced by `-`, so a hyphenated name written in prose matches its `icontains` ([#122](https://github.com/maplibre/maplibre-agent-skills/pull/122)) - `eval.yml`: a test that does not pass runs twice more, and its failure is recorded only if a re-run fails too ([#119](https://github.com/maplibre/maplibre-agent-skills/pull/119)) - `eval.yml`: a failed judge call inside an `llm-rubric` records `error` instead of `fail`, so it no longer demotes a skill ([#110](https://github.com/maplibre/maplibre-agent-skills/pull/110)) - `eval.yml`: the weekly drift check runs as three scheduled slices (Sunday, Wednesday, Friday) sized to Groq's daily token cap, and the status sync measures a run against its own plan instead of every config ([#113](https://github.com/maplibre/maplibre-agent-skills/pull/113)) - `scripts/setup-hooks.js`: `npm install` from a git worktree installs the pre-push hook instead of failing ([#103](https://github.com/maplibre/maplibre-agent-skills/pull/103)) - `eval.yml`: the runner rejects config and output paths that are not plain `evals/prompts/<skill>.yaml` files or plain directories before they reach `npm run`, answering the CodeQL shell-command alert ([#95](https://github.com/maplibre/maplibre-agent-skills/pull/95)) - evals: the judge and the deterministic assertions grade the generator's answer only; the reasoning trace is no longer prepended to the graded output ([#94](https://github.com/maplibre/maplibre-agent-skills/pull/94)) - `eval.yml`: a config that overruns its bound is now actually stopped (process-group kill with SIGKILL escalation), and a killed config's sidecar still feeds the drift issue's signals ([#93](https://github.com/maplibre/maplibre-agent-skills/pull/93)) - `eval.yml`: the weekly run is time-bounded per config and per run, records `error` (never a status flip) for infrastructure failures and cut-offs, publishes on the branch tip, and files a classified issue on any non-success run ([#89](https://github.com/maplibre/maplibre-agent-skills/pull/89)) - `scripts/lib/changelog-field.js`: HTML comments in a PR body are stripped until none remain, closing the open CodeQL alert; `package-lock.json` moved past the `fast-uri` and `qs` advisories ([#88](https://github.com/maplibre/maplibre-agent-skills/pull/88))

  2. v0.2.0 GitHub ↗
    原版更新说明

    ### Added - `maplibre-source-wiring` skill, split out of `maplibre-tile-sources` so that "the source is configured but nothing draws" routes to a focused skill; `maplibre-tile-sources` narrowed to choosing and identifying a source, and cross-references updated across the collection ([#69](https://github.com/maplibre/maplibre-agent-skills/pull/69)) - `maplibre-v6-migration` skill, for upgrading a v5 app to v6's ESM-only build and other breaking changes ([#53](https://github.com/maplibre/maplibre-agent-skills/pull/53)) - `maplibre-skill-authoring` process skill, for turning a research session into a new skill or a failure report ([#57](https://github.com/maplibre/maplibre-agent-skills/pull/57)) - `maplibre-fonts-glyphs` skill, extracted from `maplibre-cartography` and `maplibre-tile-sources` ([#56](https://github.com/maplibre/maplibre-agent-skills/pull/56)) ### Changed - `maplibre-v6-migration`: add the missing `status` field ([#77](https://github.com/maplibre/maplibre-agent-skills/pull/77)) ### Fixed - pinned generator `max_tokens` lowered 8192 → 4096; no output is lost, and far fewer calls are rejected against Groq's TPM ceiling ([#63](https://github.com/maplibre/maplibre-agent-skills/pull/63)) - `maplibre-mapbox-migration` and `maplibre-pmtiles-patterns`: corrected import and CDN examples broken by MapLibre GL JS v6's ES-module-only build ([#59](https://github.com/maplibre/maplibre-agent-skills/pull/59)) ### Internal - evals: re-ran `maplibre-cartography`, `maplibre-mapbox-migration`, `maplibre-pmtiles-patterns`, `maplibre-terrain-patterns` on the Groq pin and replaced their Cerebras-era results (#64) ([#70](https://github.com/maplibre/maplibre-agent-skills/pull/70)) - Release watch: a weekly check that files an issue when an upstream release removes, renames, or deprecates something a skill still mentions (#71) ([#74](https://github.com/maplibre/maplibre-agent-skills/pull/74)) - `eval.yml`: a publish-job failure after a passing eval now opens an `eval-publish` issue (#55) ([#60](https://github.com/maplibre/maplibre-agent-skills/pull/60)) - Versioning and CHANGELOG automation: a `Changelog` field in the PR template, entries recorded on merge, a Release workflow that cuts the version and regenerates the README skills table ([#58](https://github.com/maplibre/maplibre-agent-skills/pull/58))

当前收录版本

0.0.1

核对来源版本 ↗

质量评测

满分100 · 来自 SkillPi LAB 实验室的评测报告。

场景价值85/100

亮点

  • 解决 MapLibre 字体渲染的实际痛点,涵盖自托管、生成 PBF、本地回退、非拉丁文字等关键场景
  • 提供详细的字体选项对比和 Noto 字体处理指南
  • 包含 CJK、RTL、Devanagari 等特殊文字处理的详细说明
触发精准90/100

亮点

  • 触发词精准完整,覆盖多种变体,边界清晰
  • description 明确列出适用场景,包括文本标签渲染问题、搭建字形服务器、选择自托管与生成字体 PBF 方案等
结构规范90/100

亮点

  • Phase/步骤清晰,有出口条件,含端到端示例
  • frontmatter完整,单文件≤500行
  • 结构清晰,易于理解执行流程
执行可靠85/100

亮点

  • 工具来源明确,参数正确,覆盖主要异常
  • 不可逆操作有确认机制,可靠性良好
  • 提供详细的代码示例和配置说明
证据可验 (前四项均值)88/100

取前四项原始分值的算术平均,四舍五入取整。可通过收录报告核对各项评分与说明,运行记录需单独查证。

正文静态检测

100 / 100 · skillpi-20261123-no-r3-v1

正文未命中当前规则。

分数仅反映正文中的规则命中,供使用前参考。附件与运行行为不在此评分范围内。

权限与使用前检查

根据当前主文档自动整理,命中内容可能是示例或防护说明;不是实际权限声明,也未覆盖附件、外部依赖或运行行为。

未从主文档识别到上述常见操作,不能据此判断无需权限或没有风险。

文档引用的域名或地址

这些地址可能用于文档链接或示例,不是已批准的联网清单。使用前核对实际目的地及发送的数据。

  • demotiles.maplibre.org
  • github.com
  • maplibre.github.io
  • maplibre.org
  • unpkg.com

本站展示提示不会授予权限。涉及文件改动、密钥、外部发送或费用时,仍由你使用的工具按需确认。

安全评级与访问范围

safe · 静态证据核验,不代表运行安全保证。

使用前请由宿主核对并授权实际文件读写、外部服务和联网目的地;本站的核验不会授予任何运行权限。