---
name: "font-subsetter-woff2-optimizer"
description: "Shrink custom web font file sizes by up to 85% using pyftsubset and fonttools."
metadata:
  author: "FontTools"
  version: "1.0.0"
  runtime_compatibility:
    - "codex"
    - "claude-code"
    - "cursor"
    - "windsurf"
triggers:
  - "subset font with pyftsubset"
  - "compress ttf to woff2"
  - "reduce web font file size"
permissions:
  fs_read: true
  fs_write: "workspace"
  shell_exec: false
  net_access: false
---

# WOFF2 Font Subsetter & Glyph Optimizer

Subsets TrueType and OpenType fonts using fonttools pyftsubset: stripping unused foreign glyph ranges, removing legacy OpenType layout tables, and compressing with Google Brotli WOFF2.

## When to Invoke
Invoke this skill whenever you need to:
- subset font with pyftsubset
- compress ttf to woff2
- reduce web font file size

## Execution SOP & Rules
1. Execute pyftsubset input.ttf --unicodes="U+0020-007E" --flavor=woff2 --output-file=font.woff2.
2. Retain essential OpenType features with --layout-features="kern,liga,calt".
3. Drop unnecessary metadata tables using --drop-tables="meta,name,OS/2".
4. Configure @font-face with explicit unicode-range to enable lazy browser font downloading.

## 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.
