一键导入
widget-fonts
Dartsnut widget font catalog usage, font copy conventions, and safe font loading rules.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Dartsnut widget font catalog usage, font copy conventions, and safe font loading rules.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Dartsnut asset manifest, loader-helper, placeholder, and apply-mode workflow for art-bearing entities.
Root conf.json schema, defaults, size rules, preview handling, and reload requirements for Dartsnut projects.
Dartsnut workspace scaffold rules, just-in-time skill loading, file constraints, and emulator verification workflow.
Dartsnut display and framebuffer mapping rules for panels, physical screens, layout, clipping, and fonts.
Legacy Dartsnut runtime index that routes to the granular pydartsnut, conf, display, and asset skills.
Pixel-perfect compact UI guidance for console-style Dartsnut games and widgets.
| name | widget-fonts |
| description | Dartsnut widget font catalog usage, font copy conventions, and safe font loading rules. |
| license | MIT |
Load before copy_asset_file for fonts or when main.py loads widget fonts.
Use availableWidgetFonts from host/workspace metadata: each entry has file (basename) and glyphWidth / glyphHeight (nominal glyph size in pixels; from the WxH in names like 10x20.pil, or manifest bounds for fonts without that pattern).
read_file on font_manifest.json or repo paths outside the widget workspace.file basename from the catalog (no invented *-541a345d suffixes in code paths).copy_asset_file → ./fonts/ in the widget directory (tool strips trailing -<8 hex> from filenames)..pil and matching .pbm when both exist in the catalog.Path(__file__).parent / "fonts" in main.py.from pathlib import Path
from PIL import ImageFont
FONT_DIR = Path(__file__).parent / "fonts"
def load_widget_font(name: str, size: int | None = None):
font_path = FONT_DIR / name
if font_path.suffix.lower() == ".pil":
return ImageFont.load(str(font_path))
if size is None:
size = 12
return ImageFont.truetype(str(font_path), size)
If a font is missing from the catalog, pick the closest size match and note it briefly in the final reply.