Files
openmotion/library/design/craft/typography.md
Tom Huang ef577a7844 feat(design): integrate Open Design HTML workflows, MCP tools, and Design Studio editor (#699)
* feat(design): add Design Studio project contract and locale resources

* feat(design): port Open Design templates, systems, skills, craft and scenario guides

* feat(design): add shared design-projects service, HTTP adapter, 4 MCP tools and openmotion-design Skill

* feat(design): add Design Studio HTML preview editor, scene tabs, Explore and MCP handbook entries

* feat(design): polish Design Studio UI, live preview bridge, packaging and stdio MCP E2E tests

- Upgrade Design Studio visual design: editorial hero and elevated composer dock with Design System swatches, Design Skill picker, and example prompt pills; edge-to-edge ScaledPreviewThumb gallery cards; dot-grid device frame canvas with dimension captions; syntax-highlighted line-numbered CodeViewer; inline project rename and Open-in actions; symmetrical 8-card Explore template shelf
- Keep preview bridge mounted for live HTML previews without iframe reloads on tool toggle, prevent overlay pointer capture from swallowing annotation popover clicks, and eliminate redundant initial raw preview fetches
- Complete all 10 non-English locale dictionaries in design-ui.json and design-editor-ui.json
- Register library/design and docs/design-studio.md in distribution packaging, include openmotion-design in package Skill checks, exercise all 4 openmotion_design_* tools in phase1-package.mjs, and schedule design test suites in CI
- Add live stdio MCP subprocess E2E coverage and CodeViewer/DesignProjectList Vitest coverage

* chore(design): remove redundant More studios dropdown from DesignSceneTabs

* feat(design): add Mobile App scenario with 390x844 phone preview default

* perf(design): freeze idle rAF/WebGL/CSS animations in preview thumbs and unmount offscreen iframes

* feat(design): reuse Motion Brand Kits for Design Studio picker with hover preview and detail modal

* feat(design): add Motion-aligned Design template detail preview modal with responsive stage and navigation

* feat(design): support @ mention autocomplete and composable multi-select templates, skills and prompts in composer

* fix(design): unify studio bar tab heights to eliminate layout shift between image and design scenes

* fix(design): keep Design Studio sub-navigation bar on a single responsive row

* feat(design): move Design Studio composer to floating bottom dock with scrollable middle template gallery

* chore(design): assign dedicated mobile-app templates from Open Design catalog without overlap with prototype

* feat(design): curate flagship-first template ordering and clean gallery-first card styling

* fix(design): constrain BrandKitPicker popover max-width and scroll container height to prevent overflow

* fix(design): align active scene tab styling with Text-to-Image and match search input and button heights

* fix(design): center editor toolbar with 3-column grid and remove idle pill background on annotation tools

* refactor(design): move Preview/Code and viewport selector into canvas toolbar and use compact annotation icons

* fix(design): remove inner textarea focus ring and align composer border radii

* fix(design): match filter input height to 32px md Button height

* fix(design): eliminate leaked media-surface border on composer textarea and align template detail stage with Motion

* docs(design): include mobile-app in Design Studio scenario documentation

* feat(design): make Copy to Agent prompts self-contained with MCP install and live workspace setup

* fix(design): replace opaque region fill with crisp translucent marquee and smart popover placement

* fix(design): remove internal-link demo URL and duplicate i18n keys that overwrote Studio translations

* feat(design): keep drawn pen strokes visible during compose, add visual previews in annotations, and focus on click

* fix(design): make toolbar Comments counter button toggle the Comments panel with active state

* fix(design): auto-size project title input and remove leaked media-surface fill and gap

* test(design): pass anchor in phase1 package comment smoke and target platform-export scenario by data attribute

* fix(design): address PR review findings on entry restore, preview isolation, coordinates, save revisions, and icons

* fix(design): reject overlapping write/delete paths, enable conflict overwrite retry, and hoist optional annotation bindings

* fix(design): fetch latest project and file before rebasing discarded code draft

* fix(design): clear codeLoading in finally when discard reload fails

---------

Co-authored-by: pftom <pftom@pftomdeMacBook-Pro.local>
Co-authored-by: pftom <pftom@pftomdeMBP.lan>
Co-authored-by: pftom <pftom@Mac.lan>
2026-11-20 14:38:40 +08:00

4.7 KiB

Typography craft rules

Universal typography rules that apply on top of any DESIGN.md. The active design system decides which fonts; this file decides how they behave at every size.

Adapted from refero_skill (MIT) — distilled and re-tuned for OpenDesign's token system.

Type scale

Use a multiplicative scale (1.2 or 1.25). Cap at 6–8 sizes per artifact.

Role Range
Display 48–72 px
H1 32–48 px
H2 24–32 px
H3 20–24 px
Body 15–18 px
Small 13–14 px
Caption 11–12 px

Line height (leading)

Text size Line height
Display / H1 (≥32 px) 1.0–1.2 (tight)
Body (15–18 px) 1.5–1.6
Small (≤14 px) 1.5

CJK overrides — these are not optional

The table above is Latin leading. Latin display type can go to 1.0 because the ascender/descender slack inside the em box keeps lines apart. CJK glyphs fill the em box, so the same value makes consecutive lines touch, and multi-line Chinese headlines visibly collide.

Text size Latin CJK
Display / H1 (≥32 px) 1.0–1.2 1.3–1.4
Body (15–18 px) 1.5–1.6 1.7–1.8

The CJK floor has no upper size tier. It applies to every heading level, including the cover / hero main title — the single biggest headline on a deck's first slide. A Chinese cover title at 72 px, 96 px, or larger, especially one split into multiple lines with <br>, is still CJK display text: set line-height: 1.3–1.4 on it, never the Latin 1.0–1.2. At 96 px a 1.05 leading makes the two lines of a Chinese cover headline visibly collide. This is the single most common violation, so check the cover main title first.

Negative tracking is Latin-only for the same reason: CJK is already set on a fixed em grid, so -0.02em on a Chinese headline crowds the glyphs instead of tightening the word. Use 0 for CJK display text.

When one artifact mixes both — an English kicker over a Chinese headline is the common case — set the tight Latin values on the Latin element only. Do not inherit them onto the CJK block from a shared parent rule.

Letter-spacing — the rule that makes or breaks craft

This is the single most-skipped rule in AI-generated design. No exceptions.

Context Letter-spacing
Body text (14–18 px) 0 (default)
Small text (11–13 px) 0.01em to 0.02em (positive)
UI labels and button text 0.02em
ALL CAPS 0.06em to 0.1em (required)
Headings 32 px+ -0.01em to -0.02em
Display 48 px+ -0.02em to -0.03em

ALL CAPS without positive tracking looks cramped and amateur. Display text without negative tracking looks loose and weak. These two failures are the most reliable AI-slop tells.

The 0.06em floor is not arbitrary: it is the empirical lower bound that print and web typographers have converged on for uppercase tracking (cf. Bringhurst's Elements of Typographic Style §3.2.7, which recommends 5–10% of the em for caps; modern screen practice rounds the lower end to 0.06em). Anything tighter and the counters collide on screen; the upper bound 0.1em keeps the word from disintegrating into letters.

Font pairing

  • Maximum 2 typefaces per artifact (display + body, or one variable face used at multiple weights).
  • Always declare a system fallback chain. If the active DESIGN.md ships a webfont URL, the fallback must still produce a coherent look.
  • Never set font-family: system-ui alone on a heading — that is the textbook AI default; always pair it with an intentional first choice.

Line length

Limit body copy to 50–75 characters per line. In CSS: max-width: 65ch is a safe default.

Three-weight system

Most well-crafted UIs use exactly 3 weights:

  • Read (400 / 450) — body copy
  • Emphasize (510 / 550) — UI text, labels, navigation
  • Announce (590 / 600) — headlines, buttons

Weight 700+ is rarely needed. If your design uses bold for "emphasis on emphasis," it likely lacks weight discipline elsewhere.

Common mistakes (lint these)

  • ALL CAPS without letter-spacing ≥ 0.06em.
  • Display text (≥32 px) without negative tracking (Latin only — see the CJK overrides).
  • CJK display text at Latin leading (≤1.2), which makes the lines overlap.
  • Multi-line CJK cover / hero titles (72–96 px+, e.g. split with <br>) below 1.3 line-height.
  • Negative tracking applied to CJK text.
  • More than 3 type sizes visible above the fold.
  • Mixed serif and slab on the same screen without a clear role split.
  • Body copy in text-align: justify (creates rivers; never use on the web).