typesetting
Skill2 starsChanged 4 months agoMITView on GitHub
Implement detailed, pixel-perfect, and (where required) historically accurate typesetting across web/CSS print, Figma, and Adobe (InDesign/Illustrator). Use this skill whenever the task involves setting body text or display type to a real standard rather than eyeballing it: choosing and unit-converting size/leading/measure, applying kerning/tracking correctly, enabling the right OpenType features (small caps, oldstyle vs lining figures, ligatures), fixing widows/orphans/rivers, aligning to a baseline grid, or reproducing a historical typographic style (Venetian, Garalde, Transitional, Didone, Swiss/International, etc.). Trigger even when the user says something loose like "make this type look professional," "set this like a real book," "match this to the original edition," "the spacing feels off," "port this type spec from Figma to CSS," or "why doesn't my justified text look right." Typesetting problems rarely name themselves; if positioned text must meet a real standard, consult this skill.
In this repository3 other files it gives its agents.
- SKILL.mdSkill
- browser-printingSkill
- skill-templateSkill
The file
We split this skill into the rules it gives an agent
10 rules. About 0 are common, 7 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈7
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 35
Every typesetting decision lives at one of five nested scopes:
- Distinctive: line 90
Use the optical-size axis (or optical-size-specific cuts) when present: display cuts for large sizes, text/caption cuts for small — never …
- Distinctive: line 118
Avoid for anything read line after line.
- Distinctive: line 144
When glyphs on one line differ in size, it is one of four things — identify which before acting, because two are intentional, one is an …
- Very specific: line 177
If a few glyphs look off-size or off-weight mid-word, suspect: a fallback font substituting for missing glyphs (different metrics), …
- Very specific: line 187
Read the environment-specific reference for exact property/API/scripting details:
- Distinctive: line 208
When the brief names or implies a period, tradition, or specific edition, reproduce the
- Distinctive: line 225
Run this before declaring done — none of these throw errors, all of them read as amateurish:
- Distinctive: line 255
Metric-level: verify computed size and leading in the target's real units, not the tool's display label.
- Very specific: line 257
Paragraph-level: check for widows/orphans/rivers at the actual measure and page size, with the real (extreme-length) content, not lorem …
≈ “Common” is an estimate: at least 1 in 5 of the 213,895 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Typesetting
Typesetting is a deterministic transform from a character stream to positioned glyph outlines,
parameterized at five nested scopes and bound by three constraint sources. Do it well by
reading the constraints and making every parameter explicit, never by trusting a tool's
defaults — Figma auto line-height, CSS line-height: normal, InDesign's 120% default leading,
and Illustrator's auto leading are all different numbers, and "looks right in the tool" is not
a spec.
Work in this order: identify the target and standard → read the three constraints → set the five-scope parameter stack → convert units per environment → verify against the standard.
The unified model
Every typesetting decision lives at one of five nested scopes:
| Scope | Controls |
| Glyph | font + weight, optical size, OpenType features (ligatures, small caps, figure style, contextual/discretionary alternates, swashes), kerning |
| Word | tracking (letter-spacing), word-spacing |
| Line | point size, measure (line length), alignment / justification |
| Paragraph | leading (line-height), indent vs. space-after, hyphenation, orphans/widows, drop caps |
| Page | margins, columns, baseline grid, running heads, folios, optical margin alignment, bleed |
Three constraint sources override any aesthetic preference. Read all three before setting anything:
- Font metrics — what the file can actually do. Inspect, don't assume: unitsPerEm; hhea
and OS/2 ascent/descent/lineGap (these drive default line height and differ between tables);
available
GPOS/kernpairs; the OpenType feature list (is there a realsmcp?onum?ligavsdlig?); and any variable-font axes, especially optical size (opsz). A font that lackssmcpcannot do true small caps — faking them by scaling caps is a typographic error, not a fallback. - Substrate — the coordinate system and its unit conversion. See the conversion table below. Getting this wrong is the #1 source of "it looked right in Figma but printed wrong."
- Tradition — the rules that make a design coherent. For historical or house-style work,
the period's conventions (measure, leading, alignment, figure style, ornament) are hard
constraints, not suggestions. See
references/historical-styles.md.
Units and conversion — get this right first
Each environment has a different native unit. Pixel-perfect means converting explicitly.
| Environment | Native unit | Relation |
| Print / PostScript | point (pt) | 1 pt = 1/72 inch |
| Pica | pica | 1 pica = 12 pt |
| Web / CSS | px (reference) | 1 CSS px = 1/96 inch → 1 pt = 1.333 px, 1 px = 0.75 pt |
| Figma | px (unitless) | Figma px maps 1:1 to pt for print export at 72 dpi; not to CSS px at 96 dpi |
| InDesign / Illustrator | pt (default) | native points; docs may be in mm/inch |
Rules of thumb: for screen-only output work in CSS px. For print output, decide the
canonical unit as points, set the true type spec there, and convert into each tool. When a
spec says "10/13 Garamond" it means 10 pt type on 13 pt leading — convert to 13.333 px
line-height for CSS, or 13 for a 72-dpi Figma print frame. State the source unit in any
handoff so the next tool doesn't silently reinterpret it.
The five-scope parameter stack (defaults that are usually right)
These are professional starting points, not laws; the tradition or brief can override them.
Glyph.
- Enable the font's real features rather than faking them:
liga(standard ligatures) on for body;dlig(discretionary) only display.smcpfor small caps; never scale caps. - Figures: oldstyle (
onum) in running prose, lining (lnum) in tables/UI; tabular (tnum) wherever numbers must align in columns, proportional (pnum) in prose. - Use the optical-size axis (or optical-size-specific cuts) when present: display cuts for large sizes, text/caption cuts for small — never one master size scaled across the range.
- Trust the font's kerning; only hand-kern display lines (logos, titles) where pairs read wrong.
- Superscript/subscript (footnote marks, ordinals, chemical formulae): use the font's real
sups/subsdesigned glyphs (font-variant-positionon the web) — never synthetic scale-and-raise, which produces a too-thin, misaligned mark. Real petite caps (pcap) are a distinct, smaller variant from small caps (smcp); don't conflate them.
Word.
- Tracking: none on lowercase body text. Positive tracking (roughly +5 to +12 in 1/1000-em units, i.e. ~0.05–0.12em) on all-caps and small-caps runs, which look cramped untracked. Slight negative tracking is acceptable only on very large display type.
Line.
- Measure: 45–75 characters per line for single-column body text (66 is the classic ideal); 40–50 for multi-column. Set the column width to hit this, not the reverse.
- Alignment — four choices, each with a job:
- Flush-left, ragged-right: the safe default and the only reliably good option in a browser.
Aim for a soft rag (no hard zig-zag, no near-justified straightness);
text-wrap: prettyor manual breaks improve it. - Justified: body at a wide measure with hyphenation on and, ideally, a real paragraph composer (Adobe) or Knuth–Plass polyfill (web). Never justify a narrow measure — that is what produces rivers and gaping word spaces.
- Centered: correct for short display — title pages, poetry, invitations, epigraphs,
pull quotes, headings of 1–3 lines. Never for running body (the ragged left edge destroys
the return sweep). Break centered lines for sense, not by width, and balance line
lengths (
text-wrap: balance) so no line is much longer than its neighbors. - Flush-right: captions beside an image, marginal notes, deliberate asymmetric layout. Avoid for anything read line after line.
- Flush-left, ragged-right: the safe default and the only reliably good option in a browser.
Aim for a soft rag (no hard zig-zag, no near-justified straightness);
Paragraph.
- Leading: print body ~1.2–1.4× size; screen body ~1.4–1.6× (backlit, lower resolution wants more air). Larger measure wants more leading; tighter measure less.
- Paragraph separation: either first-line indent (typically 1 em, no space between) OR space-after — never both. Indent is the book convention; space-after the screen convention. The first paragraph after a heading takes no indent.
- Orphans/widows: forbid single-word last lines and single-line paragraph fragments across
page/column breaks (
orphans: 2; widows: 2minimum in print). - Hyphenation: on for justified text, optional for ragged; cap consecutive hyphens at 2–3.
Page.
- Baseline grid: body leading defines the grid; all vertical spacing (heading space, figure space, margins) is a multiple of it, so every text line across columns aligns.
- Margins: classical book pages use asymmetric margins (inner < top < outer < bottom); the van de Graaf / golden canons are worth applying for period work (see references).
- Optical margin alignment / hanging punctuation: hang quotes, hyphens, and stems slightly
into the margin so the text block reads visually flush. InDesign has Optical Margin Alignment;
CSS has partial
hanging-punctuation; Figma has none (do it manually). - Folios and running heads: see the browser-printing skill for the page-number reality in CSS.
Size variation within a word or line
When glyphs on one line differ in size, it is one of four things — identify which before acting, because two are intentional, one is an illusion to leave alone, and one is a bug to fix.
1. Deliberate emphasis glyphs (intentional).
- Small caps / petite caps: a capital-height letter or acronym set at roughly x-height
(
smcp/pcap), so "NASA" or a run of caps doesn't shout. Real feature only — scaling caps gives the wrong weight and spacing. A common correct pattern is a full capital leading a small-cap run (a proper initial cap followed by small caps); set the first letter as a normal cap and the remainder in small caps rather than forcing the whole run. - Drop cap / initial / versal: an oversized opening letter spanning several lines (drop cap,
sunk into the text) or rising above the first line (raised/elevated cap). A paragraph-scope
ornament, historically the versal. Implement with the tool's real feature, not a floated
guess: CSS
::first-letter { initial-letter: 3 }(or a float fallback); InDesigndropCapCharacters+dropCapLines; Illustrator/Figma have no true drop cap — build it manually as a separate, baseline-aligned text object. - Superscript / subscript: footnote references, ordinals, math/chemistry — real
sups/subsglyphs, per the Glyph rules above.
2. Optical illusion, not variation (leave it alone). Round and pointed glyphs (o, e, O, C, A, v, w) are drawn slightly taller and deeper than flat ones (x, H, z) — this overshoot makes them appear the same size; without it they'd look too small. Likewise, cap-height, x-height, ascenders, and descenders are simply different heights by design, so a lowercase "x" is legitimately shorter than a cap "H" in the same size. This is correct typography. Do not "fix" it by rescaling glyphs; doing so is what makes type look wrong. Only genuine mismatches (below) are bugs.
3. Optical sizing (intentional, whole-run).
A variable font's opsz axis (or optical-size-specific cuts) changes proportions by size —
thicker hairlines and looser spacing at small sizes. This affects the whole run consistently, not
individual glyphs, and is desirable; enable font-optical-sizing: auto rather than scaling one
master.
4. Unintended mismatch (the bug). If a few glyphs look off-size or off-weight mid-word, suspect: a fallback font substituting for missing glyphs (different metrics), synthetic bold/italic/small-caps/superscript (faked, so wrong proportions), or mixed font runs from a paste. Diagnose by inspecting the actually-rendered font and features per character; fix by loading the right font/cut or enabling the real OpenType feature.
Per-environment implementation
Read the environment-specific reference for exact property/API/scripting details:
- Web / CSS print →
references/web-css.md— property map,font-feature-settingsvsfont-variant-*, the greedy-justification problem and Knuth–Plass polyfills,text-wrap: pretty/balance, paged-media integration. - Figma →
references/figma.md— text-node properties,letterSpacing/lineHeightunits, OpenType features viafontVariations/feature flags, and what Figma cannot express (baseline grid, optical margins, true justification) so you know when to flag a lossy handoff. - Adobe (InDesign / Illustrator) →
references/adobe.md— the ExtendScript / UXP property model, paragraph vs. character styles, the Paragraph Composer (Adobe's Knuth–Plass justifier), optical margin alignment, and baseline-grid snapping.
Cross-tool handoff is lossy in one direction. InDesign/CSS-with-polyfill can express things Figma cannot (grid snapping, optical margins, paragraph-level justification). When porting a spec, carry the canonical parameter set (in points) as the source of truth and regenerate it in each tool, rather than eyeball-matching one tool's render to another's.
Historical accuracy
When the brief names or implies a period, tradition, or specific edition, reproduce the
rules, not just the fonts. A Jenson revival set with tight modern tracking, lining figures,
and space-after paragraphs is a costume, not a reconstruction. Read
references/historical-styles.md for the per-period spec (typeface class, measure, leading,
alignment, figure style, paragraph convention, ornament, margin canon) covering Venetian/
Humanist, Garalde/Old Style, Transitional, Didone/Modern, Slab, Grotesque, and Swiss/
International, plus how to research and match a specific historical edition.
Minimum bar for "historically accurate": correct typeface class, correct figure style for the period, correct paragraph convention (indent vs. space), correct quotation and dash conventions for the language/era, and a measure and leading consistent with the model. Verify against a facsimile or high-resolution scan of the source when one exists.
Detail/quality checklist (the tells a typographer catches instantly)
Run this before declaring done — none of these throw errors, all of them read as amateurish:
- Straight quotes/apostrophes instead of typographic ("smart") ones; feet/inch marks misused.
- Hyphen where an en-dash (ranges) or em-dash (parenthetical) belongs; spaced vs. unspaced dash used inconsistently.
- Faked small caps (scaled caps) or faked bold/italic (synthetic) when the font has real cuts.
- Synthetic (scaled-and-raised) superscript/subscript instead of real
sups/subsglyphs. - Drop cap or raised initial that doesn't sit on a baseline / align to the text block cleanly.
- "Fixing" overshoot or cap-height/x-height differences by rescaling glyphs — that creates the wrong look; leave designed height differences alone.
- Centered running body text, or a centered block broken by width rather than for sense.
- Off-size glyphs mid-word from a fallback font, synthetic styling, or a mixed-font paste.
- Lining figures in running prose, or proportional figures in a numeric column.
- Double spaces after periods; multiple consecutive spaces standing in for indents.
- Widows, orphans, and rivers in justified text; a heading stranded at the foot of a page.
- Tracking applied to lowercase body; all-caps left untracked.
- Line length outside 45–75 characters; leading that fights the measure.
- Ligatures off where the design needs them (fi, fl clashes), or discretionary ligatures left on in body text.
- Baseline grid ignored, so facing columns don't align line-for-line.
- Units silently reinterpreted across tools (the 96-vs-72 dpi trap).
Verification
- Character-level: confirm the rendered glyphs are the intended features — inspect that
smcp,onum,ligaactually took effect (they fail silently if the font lacks the feature or the property name is wrong). In the browser, comparefont-feature-settingsagainstfont-variant-*; in Adobe, check the glyph panel; in Figma, confirm the feature flag applied. - Metric-level: verify computed size and leading in the target's real units, not the tool's display label. For print, render to PDF and measure.
- Paragraph-level: check for widows/orphans/rivers at the actual measure and page size, with the real (extreme-length) content, not lorem ipsum.
- Standard-level: for historical or house-style work, diff against the reference facsimile or the style spec point by point using the checklist above.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

