---
name: "opentype-js-font-path-metrics"
description: "Inspect font metrics, render vector glyph paths, and extract Bezier outlines with opentype.js."
metadata:
  author: "Frederik De Bleser"
  version: "1.0.0"
  runtime_compatibility:
    - "codex"
    - "claude-code"
    - "cursor"
    - "windsurf"
triggers:
  - "convert text to svg path opentype.js"
  - "inspect font metrics opentype"
  - "extract font glyphs javascript"
permissions:
  fs_read: true
  fs_write: "workspace"
  shell_exec: false
  net_access: false
---

# opentype.js Vector Font Glyphs & Metrics

Parses TrueType (TTF), OpenType (OTF), and WOFF fonts in JavaScript with opentype.js: extracting font kerning, ascenders/descenders, translating text into SVG paths, and modifying font tables.

## When to Invoke
Invoke this skill whenever you need to:
- convert text to svg path opentype.js
- inspect font metrics opentype
- extract font glyphs javascript

## Execution SOP & Rules
1. Load fonts asynchronously with opentype.load(url, (err, font) => { ... }).
2. Extract vector paths using font.getPath(text, x, y, fontSize).toSVG(2).
3. Calculate precise text bounding box with path.getBoundingBox().
4. Draw glyph paths directly onto Canvas 2D contexts using path.draw(ctx).

## Verification Checklist
- Run local linting, syntax validation, and type-checks before reporting completion.
- Ensure all created or modified files adhere to workspace boundaries and avoid uncommitted secrets.
- Verify tests or build commands exit cleanly with return code 0.
