Files
2nd/10_Wiki/Topic_CSS/CSS_Custom_Fonts.md
T
koriweb 9609c04755 docs(10_Wiki): W3Schools 위키화 — HTML/CSS/JavaScript(core)
W3Schools 튜토리얼을 P-Reinforce v3.1 포맷으로 위키화(영어 본문, 한/영 섹션 헤더).
- Topic_HTML: 59문서 (튜토리얼+예제, 레퍼런스/메타 제외)
- Topic_CSS: 190문서 (메인 + Advanced/Flexbox/Grid/RWD 전체)
- Topic_JavaScript: 120문서 (코어 언어; Temporal/DOM상세/BOM/WebAPI/AJAX/jQuery/Graphics 등은 후속)
각 폴더 00_INDEX.md(MOC) 포함. 코드 verbatim, 미확인분은 "Not found in source" 표기.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-23 19:21:18 +09:00

131 lines
5.8 KiB
Markdown

---
id: css-custom-fonts
title: "CSS Custom Fonts"
category: "Frontend"
status: "draft"
verification_status: "conceptual"
canonical_id: ""
aliases: ["@font-face", "web fonts", "CSS custom fonts", "font-face rule", "WOFF fonts"]
duplicate_of: ""
source_trust_level: "B"
confidence_score: 0.87
created_at: 2026-06-23
updated_at: 2026-06-23
review_reason: ""
merge_history: []
tags: ["css", "web", "frontend", "w3schools", "fonts", "font-face", "typography"]
raw_sources: ["https://www.w3schools.com/css/css3_fonts.asp"]
applied_in: []
github_commit: ""
---
# [[CSS Custom Fonts]]
## 🎯 한 줄 통찰 (One-line insight)
The CSS `@font-face` rule lets you define and load custom (web) fonts so a page can use a typeface without it being installed on the visitor's computer — the font file downloads automatically when needed. [S1]
## 🧠 핵심 개념 (Core concepts)
- **`@font-face` defines and loads custom fonts** — it allows you to define and load custom fonts for use on a webpage. [S1]
- **No local installation required** — the font does not need to be installed on the user's computer; it downloads automatically when needed. [S1]
- **Two required descriptors** — `font-family` (the font name you choose) and `src` (the URL of the font file). [S1]
- **Weight variants need their own rule** — to support bold, define an additional `@font-face` rule with `font-weight: bold;` pointing at the bold font file. [S1]
- **Web-optimized formats exist** — WOFF and WOFF2 (Web Open Font Format) are optimized for web use and broadly supported; TTF/OTF are popular for desktop but are not web-optimized. [S1]
## 🧩 추출된 패턴 (Extracted patterns)
- **Define-then-use pattern** — declare a font with `@font-face { font-family; src; }`, then reference that name in a selector's `font-family`. [S1]
- **Weight-variant pattern** — add a second `@font-face` with `font-weight: bold;` and a bold font file. [S1]
## 📖 세부 내용 (Details)
**The CSS `@font-face` Rule** [S1]
The CSS `@font-face` rule allows you to define and load custom fonts for use on a webpage. The font does not need to be installed on the user's computer; it downloads automatically when needed.
**Basic custom font example** [S1]
In the `@font-face` rule, first define a name for the font (e.g. `myFont`) and then point to the font file. To use the font for an HTML element, refer to the font name through the `font-family` property:
```css
@font-face {
font-family: myFont;
src: url(sansation_light.woff);
}
p {
font-family: myFont;
}
```
**Using bold text with `@font-face`** [S1]
You must add another `@font-face` rule containing descriptors for bold text. The `src` property points to a different (bold) font file, and `font-weight: bold;` ties it to bold usage:
```css
@font-face {
font-family: myFont;
src: url(sansation_bold.woff);
font-weight: bold;
}
```
This way the browser uses the specific bold font file whenever bold text of `myFont` is requested.
**Font formats** [S1]
- **WOFF / WOFF2 (Web Open Font Format)** — optimize file size for web use, developed in 2009, have W3C Recommendation status, and are supported across all major browsers.
- **TTF (TrueType Fonts)** — emerged in the late 1980s via Apple; popular for desktop use but not web-optimized.
- **OTF (OpenType Fonts)** — developed by Apple and Microsoft as an advanced, scalable format; popular for desktop use but not web-optimized.
**CSS `@font-face` Descriptors table** [S1]
| Descriptor | Description |
|---|---|
| `font-family` | Required; defines the font name |
| `src` | Required; defines the URL of the font file |
| `font-stretch` | Optional; default `normal` |
| `font-style` | Optional; default `normal` |
| `font-weight` | Optional; default `normal` |
| `font-display` | Optional; default `auto` |
| `unicode-range` | Optional; default `U+0-10FFFF` |
## 🛠️ 적용 사례 (Applied in summary)
The page's own demonstrations (defining `myFont` via `@font-face` and applying it to `p`, plus the bold variant) serve as the applied examples. No external project/commit applications found in the source.
## 💻 코드 패턴 (Code patterns)
Define and use a custom font (language: CSS):
```css
@font-face {
font-family: myFont;
src: url(sansation_light.woff);
}
p {
font-family: myFont;
}
```
Add a bold variant:
```css
@font-face {
font-family: myFont;
src: url(sansation_bold.woff);
font-weight: bold;
}
```
## ⚖️ 비교 및 선택 기준 (Comparison & decision criteria)
- **WOFF/WOFF2 vs TTF/OTF** — WOFF and WOFF2 are optimized for the web (smaller files, W3C Recommendation, broad browser support); TTF and OTF are popular for desktop use but are not web-optimized. Prefer WOFF/WOFF2 for the `src` of web fonts. [S1]
- **Regular vs bold** — a single `@font-face` covers the regular weight; declare a separate `@font-face` with `font-weight: bold;` to load a dedicated bold file. [S1]
## ⚖️ 모순 및 업데이트 (Contradictions & updates)
No contradictions found in the source.
## ✅ 검증 상태 및 신뢰도
- **상태:** draft
- **검증 단계:** conceptual (실제 적용 사례 발견 시 applied/validated로 승격 가능)
- **출처 신뢰도:** B (W3Schools — widely used educational reference, not a primary standards body)
- **신뢰 점수:** 0.87
- **중복 검사 결과:** 신규 생성 (New discovery)
## 🔗 지식 그래프 (Knowledge Graph)
- **상위/루트:** [[CSS Tutorial]]
- **관련 개념:** [[CSS Text Effects]], [[CSS Text Shadow Effects]], [[CSS Box Shadow]]
- **참조 맥락:** Referenced when loading a brand or non-system typeface so it renders consistently regardless of the visitor's installed fonts.
## 📚 출처 (Sources)
- [S1] W3Schools — CSS Custom Fonts — https://www.w3schools.com/css/css3_fonts.asp
## 📝 변경 이력 (Change history)
- 2026-06-23: Initial draft synthesized from the W3Schools "CSS Custom Fonts" page (Astra wiki-curation, P-Reinforce v3.1 format).