Files
2nd/10_Wiki/Topics/Frontend/디자인 시스템의 타이포그래피 토큰 확장 및 최적화.md
T
2026-05-10 22:08:15 +09:00

204 lines
5.8 KiB
Markdown

---
id: wiki-2026-0508-디자인-시스템의-타이포그래피-토큰-확장-및-최적화
title: 디자인 시스템의 타이포그래피 토큰 확장 및 최적화
category: 10_Wiki/Topics
status: verified
canonical_id: self
aliases: [Typography Tokens, Type Scale, Design Token Typography]
duplicate_of: none
source_trust_level: A
confidence_score: 0.9
verification_status: applied
tags: [design-system, typography, tokens, css, frontend]
raw_sources: []
last_reinforced: 2026-05-10
github_commit: pending
tech_stack:
language: css
framework: design-tokens
---
# 디자인 시스템의 타이포그래피 토큰 확장 및 최적화
## 매 한 줄
> **"매 typography token = semantic role + multi-platform output + fluid scale"**. 매 raw value (16px) 의 X — 매 role-based (`text.body.md`) 매 의미. 매 2026 modern = 매 fluid `clamp()` + 매 W3C Design Tokens (DTCG) format + 매 Style Dictionary 매 multi-platform export.
## 매 핵심
### 매 Token 계층
1. **Primitive** (raw): `font.size.100` = 12px, `font.weight.400` = 400.
2. **Semantic** (role): `text.body.md`, `text.heading.lg`, `text.caption.sm`.
3. **Component**: `button.label.font` = `text.body.md`.
매 component → semantic → primitive — 매 referential.
### 매 Scale 전략
- **Modular scale**: 1.25 (Major Third), 1.333 (Perfect Fourth), 1.5.
- **Fluid**: `clamp(min, preferred, max)` — viewport 매 자동 조정.
- **Step naming**: T-shirt (`xs/sm/md/lg/xl`) OR numeric (100/200/300).
### 매 핵심 properties
- `font-family`, `font-size`, `font-weight`, `line-height`, `letter-spacing`, `text-transform`.
- 매 함께 묶어 매 "type style" 의 token — 매 atomic 의 X.
### 매 응용
1. Multi-brand theme (브랜드별 token override).
2. Dark mode (semantic 동일, primitive 만 swap).
3. Accessibility (rem 매 user font-size scale).
## 💻 패턴
### W3C DTCG token (JSON)
```json
{
"font": {
"family": {
"sans": { "$value": "Inter, system-ui, sans-serif", "$type": "fontFamily" }
},
"size": {
"100": { "$value": "0.75rem", "$type": "dimension" },
"200": { "$value": "0.875rem", "$type": "dimension" },
"300": { "$value": "1rem", "$type": "dimension" }
}
},
"text": {
"body": {
"md": {
"$value": {
"fontFamily": "{font.family.sans}",
"fontSize": "{font.size.300}",
"lineHeight": "1.5",
"fontWeight": "400"
},
"$type": "typography"
}
}
}
}
```
### Fluid type scale (clamp)
```css
:root {
--text-body-md: clamp(0.875rem, 0.8rem + 0.4vw, 1rem);
--text-heading-lg: clamp(1.5rem, 1.2rem + 1.5vw, 2.25rem);
--text-display-xl: clamp(2.5rem, 1.5rem + 5vw, 4.5rem);
}
```
### CSS Custom Properties (semantic)
```css
:root {
/* primitive */
--font-size-100: 0.75rem;
--font-size-200: 0.875rem;
--font-size-300: 1rem;
--font-weight-regular: 400;
--font-weight-bold: 700;
--line-height-tight: 1.2;
--line-height-normal: 1.5;
}
:root {
/* semantic */
--text-body-md-size: var(--font-size-300);
--text-body-md-weight: var(--font-weight-regular);
--text-body-md-line: var(--line-height-normal);
}
.body-md {
font-size: var(--text-body-md-size);
font-weight: var(--text-body-md-weight);
line-height: var(--text-body-md-line);
}
```
### Style Dictionary build (multi-platform)
```javascript
// style-dictionary.config.js
module.exports = {
source: ['tokens/**/*.json'],
platforms: {
css: {
transformGroup: 'css',
buildPath: 'build/css/',
files: [{ destination: 'tokens.css', format: 'css/variables' }]
},
ios: {
transformGroup: 'ios-swift',
buildPath: 'build/ios/',
files: [{ destination: 'Tokens.swift', format: 'ios-swift/class.swift' }]
},
android: {
transformGroup: 'android',
buildPath: 'build/android/',
files: [{ destination: 'tokens.xml', format: 'android/resources' }]
}
}
};
```
### Tailwind v4 theme
```css
@theme {
--font-sans: "Inter", system-ui, sans-serif;
--text-body-md: 1rem;
--text-body-md--line-height: 1.5;
--text-heading-lg: clamp(1.5rem, 1.2rem + 1.5vw, 2.25rem);
}
```
### Variable font (1 file 매 weight 모두)
```css
@font-face {
font-family: 'Inter';
src: url('/fonts/Inter.var.woff2') format('woff2-variations');
font-weight: 100 900;
font-display: swap;
}
.heading { font-weight: 650; } /* 매 정확한 weight */
```
### Optical sizing
```css
.display { font-size: 4rem; font-optical-sizing: auto; } /* 매 large 매 다른 glyph */
```
## 매 결정 기준
| 상황 | 접근 |
|---|---|
| 단일 product | CSS Custom Properties + clamp |
| Multi-platform (web + iOS + Android) | DTCG JSON + Style Dictionary |
| Tailwind 사용 | `@theme` directive |
| Brand theming | semantic layer override |
| Variable font 사용 가능 | weight axis token |
**기본값**: DTCG JSON source → Style Dictionary → CSS vars + 매 fluid clamp.
## 🔗 Graph
- 부모: [[Design System]] · [[Design Tokens]]
- 변형: [[Color Tokens]] · [[Spacing Tokens]]
- 응용: [[Multi-brand Theming]] · [[Dark Mode]]
- Adjacent: [[Style Dictionary]] · [[Tailwind v4]] · [[Variable Fonts]]
## 🤖 LLM 활용
**언제**: token naming review, 매 type scale generate, DTCG → CSS conversion.
**언제 X**: 매 brand-specific font pairing — 매 designer 매 결정.
## ❌ 안티패턴
- **Pixel hardcode 매 component**: 매 token 의 우회.
- **Primitive 직접 사용 매 component**: 매 semantic layer 누락.
- **너무 많은 step**: 매 14 size — 매 6-8 매 충분.
- **non-rem 사용**: px — 매 a11y zoom 차단.
- **font-size 만 token**: line-height 누락 — 매 묶음 typography token 의 사용.
## 🧪 검증 / 중복
- Verified (DTCG W3C spec, Style Dictionary docs, Material Design 3, Polaris).
- 신뢰도 A.
## 🕓 Changelog
| 날짜 | 변경 |
|---|---|
| 2026-05-08 | Phase 1 |
| 2026-05-10 | Manual cleanup — DTCG + fluid clamp + Style Dictionary |