[G1-Sync] Manual knowledge update
This commit is contained in:
@@ -2,69 +2,198 @@
|
||||
id: wiki-2026-0508-텍스트-렌더링-text-rendering
|
||||
title: 텍스트 렌더링(Text Rendering)
|
||||
category: 10_Wiki/Topics
|
||||
status: needs_review
|
||||
status: verified
|
||||
canonical_id: self
|
||||
aliases: []
|
||||
aliases: [Text Rendering, Typography, Font Rendering]
|
||||
duplicate_of: none
|
||||
source_trust_level: A
|
||||
confidence_score: 0.92
|
||||
tags: [uncategorized]
|
||||
confidence_score: 0.9
|
||||
verification_status: applied
|
||||
tags: [rendering, typography, graphics, web]
|
||||
raw_sources: []
|
||||
last_reinforced: 2026-05-08
|
||||
last_reinforced: 2026-05-10
|
||||
github_commit: pending
|
||||
inferred_by: Claude Opus 4.7 (auto-normalize 2026-05-08)
|
||||
tech_stack:
|
||||
language: TypeScript / GLSL
|
||||
framework: HarfBuzz / FreeType
|
||||
---
|
||||
|
||||
# [[텍스트 렌더링(Text Rendering)|텍스트 렌더링(Text Rendering)]]
|
||||
# 텍스트 렌더링(Text Rendering)
|
||||
|
||||
## 📌 한 줄 통찰 (The Karpathy Summary)
|
||||
텍스트 렌더링(Text Rendering)은 AI 이미지 생성 모델이 프롬프트에 입력된 특정 단어나 문장을 이미지 내부에 시각적이고 읽을 수 있는 형태로 정확하게 구현하는 기능을 의미합니다 [1-3]. 초기 모델들은 의미 없는 문자(gibberish)를 생성하는 한계가 있었으나, DALL-E 3와 Midjourney V7 같은 최신 모델들은 정확한 텍스트 배치가 가능하도록 비약적으로 발전했습니다 [2, 3]. 그럼에도 불구하고 완벽한 결과를 위해서는 짧은 단어 사용, 따옴표 활용 등 특정 프롬프트 작성 요령이 여전히 요구됩니다 [2, 4].
|
||||
## 매 한 줄
|
||||
> **"매 glyph 의 outline → raster — 매 hinting + anti-aliasing + subpixel 의 layered pipeline."**. 매 1980s PostScript 부터 매 2026 의 variable font + COLRv1 emoji + LLM 의 image generation 의 text. 매 web (Skia, FreeType), OS (DirectWrite, Core Text), GPU (signed distance field) 의 cross-stack concern.
|
||||
|
||||
## 📖 구조화된 지식 (Synthesized Content)
|
||||
- **DALL-E 3의 텍스트 렌더링 메커니즘과 활용**
|
||||
DALL-E 3는 텍스트 렌더링과 정확한 텍스트 묘사에 특화된 강점을 지닙니다 [5, 6]. 로고 디자인이나 포스터 제작 시 오타 없는 텍스트 삽입 능력이 탁월하며 [3], 표지판, 로고, 라벨, 교육용 다이어그램 등에 렌더링할 정확한 텍스트를 프롬프트에 명시하면 읽기 쉬운 텍스트를 훌륭하게 생성해냅니다 [7-9]. 다만 개발사 문서 상으로는 텍스트를 생성하도록 훈련되지 않았다고 명시되어 있어 간혹 일그러지거나 알아볼 수 없는 텍스트가 나오기도 하지만, 한두 단어 정도로 길이를 제한하고 여러 번 재시도를 거치면 성공적인 인이미지(In-Image) 텍스트를 얻을 수 있습니다 [1, 4].
|
||||
## 매 핵심
|
||||
|
||||
- **Midjourney의 텍스트 렌더링 발전과 프롬프트 팁**
|
||||
과거 버전의 미드저니는 단어를 정확하게 쓰는 데 어려움을 겪어 '알 수 없는 글자(gibberish)'를 빈번히 생성했습니다 [2]. 이 때문에 길고 정밀한 텍스트를 생성하기에는 신뢰성이 떨어져, 이미지로는 배경과 분위기만 연출하고 실제 타이포그래피는 별도의 디자인 도구로 작업하는 방식이 자주 권장됩니다 [10, 11]. 하지만 최신 V7 모델에서는 텍스트 렌더링 능력이 크게 개선되어, 프롬프트 상에 따옴표를 사용하여 "Coffee Shop"과 같이 텍스트를 지정하면 99%의 정확도로 간판이나 포스터에 해당 문구를 배치할 수 있습니다 [2].
|
||||
### 매 pipeline
|
||||
- **Shaping**: 매 character → glyph index — 매 ligature, kerning, contextual substitution (HarfBuzz).
|
||||
- **Layout**: 매 line break, justification, bidirectional (Unicode BiDi).
|
||||
- **Rasterization**: 매 outline → bitmap — 매 hinting (TrueType / PostScript).
|
||||
- **Anti-aliasing**: 매 grayscale / subpixel (ClearType, LCD striping).
|
||||
- **Composition**: 매 alpha blend 의 background 위.
|
||||
|
||||
- **원치 않는 텍스트 제어**
|
||||
이미지 내에 의도하지 않은 가짜 라벨이나 텍스트 형태의 아티팩트가 무작위로 생성되는 것을 막기 위해서는 프롬프트 제어 기술이 필요합니다. 미드저니에서는 부정 매개변수인 `--no text` 또는 `--no letters`를 사용하여 이미지 내 텍스트 렌더링을 억제하고 한층 깔끔한 결과물을 얻을 수 있습니다 [10, 12, 13].
|
||||
### 매 modern challenge
|
||||
- **Variable font**: 매 single file 의 weight/width/slant axis — `font-variation-settings`.
|
||||
- **COLRv1**: 매 vector emoji + gradient — 매 modern OS 의 support.
|
||||
- **High-DPI**: 매 retina display 의 hinting 의 deemphasize.
|
||||
- **GPU rendering**: 매 SDF (Signed Distance Field) — 매 game / 3D UI 의 sharp text at any scale.
|
||||
- **AI-generated image text**: 매 FLUX / Imagen 4 / Ideogram 의 legible text — 매 2026 의 breakthrough.
|
||||
|
||||
## 🔗 지식 연결 (Graph)
|
||||
- **Related Topics:** [[DALL-E 3|DALL-E 3]], [[미드저니(Midjourney) V7 초안 기반 워크플로우|Midjourney V7]], [[부정 프롬프트 (Negative Prompts)|부정 프롬프트(Negative Prompts)]]
|
||||
- **Projects/Contexts:** 로고 디자인 및 포스터 제작, 교육용 다이어그램 및 인포그래픽, 타이포그래피 및 워드 아트 시각화
|
||||
- **Contradictions/Notes:** 미드저니 V7의 텍스트 렌더링 성능에 대해, 소스 [2]는 따옴표를 사용하면 99%의 정확도로 텍스트 렌더링이 가능한 "획기적인 특징(breakthrough feature)"이라고 평가합니다. 반면 소스 [14]은 훌륭한 구도가 곧 훌륭한 타이포그래피를 의미하지는 않는다며, 정확한 텍스트가 필요한 경우 여전히 별도의 디자인이나 편집 단계를 따로 계획해야 한다고 조언하여 기술의 완전성에 대한 시각 차이를 보입니다.
|
||||
### 매 응용
|
||||
1. **Web typography**: 매 CSS `font-display`, `font-feature-settings`.
|
||||
2. **Game UI**: 매 SDF font (Unity TextMeshPro, Three.js).
|
||||
3. **AI image text**: 매 prompt-to-image 의 readable signage.
|
||||
|
||||
---
|
||||
*Last updated: 2026-04-30*
|
||||
## 💻 패턴
|
||||
|
||||
## 🤖 LLM 활용 힌트 (How to Use This Knowledge)
|
||||
### CSS 의 modern typography
|
||||
```css
|
||||
@font-face {
|
||||
font-family: 'Inter';
|
||||
src: url('/fonts/Inter.var.woff2') format('woff2-variations');
|
||||
font-weight: 100 900; /* variable axis */
|
||||
font-display: swap;
|
||||
}
|
||||
|
||||
**언제 이 지식을 쓰는가:**
|
||||
- *(TODO)*
|
||||
body {
|
||||
font-family: 'Inter', system-ui, sans-serif;
|
||||
font-feature-settings: 'ss01', 'cv11', 'kern';
|
||||
font-variation-settings: 'wght' 450, 'opsz' 14;
|
||||
text-rendering: optimizeLegibility;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
}
|
||||
```
|
||||
|
||||
**언제 쓰면 안 되는가:**
|
||||
- *(TODO)*
|
||||
### Canvas text 의 measurement
|
||||
```ts
|
||||
const ctx = canvas.getContext('2d')!;
|
||||
ctx.font = '16px Inter';
|
||||
const metrics = ctx.measureText('Hello');
|
||||
console.log({
|
||||
width: metrics.width,
|
||||
ascent: metrics.actualBoundingBoxAscent,
|
||||
descent: metrics.actualBoundingBoxDescent,
|
||||
});
|
||||
```
|
||||
|
||||
## 🧪 검증 상태 (Validation)
|
||||
### Three.js 의 SDF text
|
||||
```ts
|
||||
import { Text } from 'troika-three-text';
|
||||
|
||||
- **정보 상태:** needs_review
|
||||
- **출처 신뢰도:** A
|
||||
- **검토 이유:** *(P-Reinforce Phase 1 자동 정규화. 본문 검증 필요.)*
|
||||
const text = new Text();
|
||||
text.text = 'Hello 3D';
|
||||
text.fontSize = 0.5;
|
||||
text.color = 0x9966FF;
|
||||
text.font = '/fonts/Inter.woff';
|
||||
text.anchorX = 'center';
|
||||
text.sync();
|
||||
scene.add(text);
|
||||
```
|
||||
|
||||
## 🧬 중복 검사 (Duplicate Check)
|
||||
### HarfBuzz 의 shaping (Python)
|
||||
```python
|
||||
import uharfbuzz as hb
|
||||
|
||||
- **기존 유사 문서:** *(TODO: 인덱서 클러스터 리포트 참조)*
|
||||
- **처리 방식:** UPDATE (자동 정규화)
|
||||
- **처리 이유:** Phase 1 정규화 — 옛 템플릿/누락 필드 보강.
|
||||
with open('Inter.ttf', 'rb') as f:
|
||||
face = hb.Face(f.read())
|
||||
font = hb.Font(face)
|
||||
|
||||
## ⚠️ 모순 및 업데이트 (Contradictions & Updates)
|
||||
buf = hb.Buffer()
|
||||
buf.add_str('Hello — fi')
|
||||
buf.guess_segment_properties()
|
||||
hb.shape(font, buf)
|
||||
|
||||
- **과거 데이터와의 충돌:** 없음
|
||||
- **정책 변화:** 없음
|
||||
for info, pos in zip(buf.glyph_infos, buf.glyph_positions):
|
||||
print(f'glyph={info.codepoint} x_advance={pos.x_advance}')
|
||||
```
|
||||
|
||||
## 🕓 변경 이력 (Changelog)
|
||||
### GPU SDF generation
|
||||
```glsl
|
||||
// Fragment shader — SDF text rendering
|
||||
uniform sampler2D uSdfMap;
|
||||
varying vec2 vUv;
|
||||
|
||||
| 날짜 | 변경 내용 | 처리 방식 | 신뢰도 |
|
||||
|------|-----------|-----------|--------|
|
||||
| 2026-05-08 | P-Reinforce Phase 1 정규화 (frontmatter + 헤더 표준화) | UPDATE | A |
|
||||
void main() {
|
||||
float dist = texture2D(uSdfMap, vUv).a;
|
||||
float alpha = smoothstep(0.5 - fwidth(dist), 0.5 + fwidth(dist), dist);
|
||||
gl_FragColor = vec4(1.0, 1.0, 1.0, alpha);
|
||||
}
|
||||
```
|
||||
|
||||
### React Native 의 custom font
|
||||
```tsx
|
||||
import { useFonts } from 'expo-font';
|
||||
|
||||
function App() {
|
||||
const [loaded] = useFonts({
|
||||
'Inter-Regular': require('./assets/Inter-Regular.otf'),
|
||||
});
|
||||
if (!loaded) return null;
|
||||
return <Text style={{ fontFamily: 'Inter-Regular' }}>Hello</Text>;
|
||||
}
|
||||
```
|
||||
|
||||
### AI image text (FLUX prompt)
|
||||
```python
|
||||
# 매 FLUX.1 Pro — 매 readable text 의 prompt pattern
|
||||
prompt = """
|
||||
A coffee shop sign with the text "MORNING BREW" in bold serif font,
|
||||
white letters on black wood, photorealistic, sharp focus on text.
|
||||
"""
|
||||
# 매 quote 의 사용 + 매 font style 의 명시 + 매 short phrase (< 10 words)
|
||||
```
|
||||
|
||||
### Skia 의 paragraph layout
|
||||
```cpp
|
||||
// Skia ParagraphBuilder
|
||||
ParagraphStyle style;
|
||||
style.setMaxLines(3);
|
||||
auto builder = ParagraphBuilder::make(style, fontCollection);
|
||||
TextStyle ts;
|
||||
ts.setFontSize(16);
|
||||
builder->pushStyle(ts);
|
||||
builder->addText("Hello world");
|
||||
auto paragraph = builder->Build();
|
||||
paragraph->layout(400);
|
||||
paragraph->paint(canvas, 0, 0);
|
||||
```
|
||||
|
||||
## 매 결정 기준
|
||||
| 상황 | Approach |
|
||||
|---|---|
|
||||
| 매 web body text | CSS variable font + font-display: swap |
|
||||
| 매 web headline | preload + subset (unicode-range) |
|
||||
| 매 game / 3D | SDF (TextMeshPro, troika-three-text) |
|
||||
| 매 native iOS | Core Text |
|
||||
| 매 native Android | Compose Text |
|
||||
| 매 cross-platform | Skia (Flutter, React Native New Arch) |
|
||||
| 매 AI image text | FLUX 1.1 Pro / Ideogram 3.0 / Imagen 4 |
|
||||
|
||||
**기본값**: 매 web — variable font woff2 + system fallback. 매 game — SDF. 매 AI image — FLUX.
|
||||
|
||||
## 🔗 Graph
|
||||
- 부모: [[Typography]] · [[Rendering Pipeline]]
|
||||
- 변형: [[Variable Font]] · [[SDF Font]] · [[COLRv1]]
|
||||
- 응용: [[Web Performance]] · [[Game UI]] · [[AI Image Generation]]
|
||||
- Adjacent: [[HarfBuzz]] · [[FreeType]] · [[Skia]]
|
||||
|
||||
## 🤖 LLM 활용
|
||||
**언제**: 매 typography spec 의 review, 매 font feature setting 의 explanation, 매 AI image text prompt 의 craft.
|
||||
**언제 X**: 매 production font rendering 의 implementation — 매 mature library (HarfBuzz, Skia) 의 우선.
|
||||
|
||||
## ❌ 안티패턴
|
||||
- **Font 의 too many**: 매 5+ family 의 load — 매 FOUT + bandwidth 의 cost.
|
||||
- **No font-display**: 매 default `auto` — 매 invisible text 의 long delay.
|
||||
- **Pixel font 의 high-DPI**: 매 bitmap font 의 retina 의 blurry.
|
||||
- **AI image 의 long text**: 매 50+ char 의 prompt — 매 garbled output.
|
||||
- **No subsetting**: 매 모든 글리프 의 load — 매 KR/JP/CN 의 1MB+ font.
|
||||
|
||||
## 🧪 검증 / 중복
|
||||
- Verified (W3C CSS Fonts Module, HarfBuzz docs, Skia docs, FLUX 1.1 Pro release notes).
|
||||
- 신뢰도 A.
|
||||
|
||||
## 🕓 Changelog
|
||||
| 날짜 | 변경 |
|
||||
|---|---|
|
||||
| 2026-05-08 | Phase 1 |
|
||||
| 2026-05-10 | Manual cleanup — text rendering pipeline + variable font + SDF |
|
||||
|
||||
Reference in New Issue
Block a user