diff options
| author | eunhhu <[email protected]> | 2026-09-28 15:03:30 +0100 |
|---|---|---|
| committer | eunhhu <[email protected]> | 2026-09-28 15:03:30 +0100 |
| commit | 5788d7e5bd6a26421346d69ae517502527940a0b (patch) | |
| tree | ee540bf287a41bef4b052f43b4fe9c9c48099776 /docs | |
| parent | b5659615bd770fd641f389e5fde8ae97be505fca (diff) | |
| download | vega-5788d7e5bd6a26421346d69ae517502527940a0b.tar.gz vega-5788d7e5bd6a26421346d69ae517502527940a0b.zip | |
Shape the Universal Shaping Engine's scripts as HarfBuzz does
The USE shaper, from HarfBuzz 10.2's source, for Sinhala, Tibetan,
Javanese, Balinese, Mongolian and the rest of its eighty-odd scripts
(and Indic fonts with the new dev3-style tags). The syllable machine
reads past CGJs and ZWNJs that marks follow; rphf goes on each
syllable's first glyphs and records the repha it made, pref records its
pre-base glyph, with substitution marks cleared between; a repha moves
before the first post-base glyph and pre-base vowels move back. Scripts
that join like Arabic take Arabic's forms (Mongolian's free variation
selectors their base's), the others join syllable to syllable. Marks
lose their advances before GPOS.
text/syllabic.py carries HarfBuzz's compressed USE table over as it is,
compiles the USE grammar with the others (100,000 random runs against
Ragel's machine: no syllable differs), and checks at compile time that
the categories syllabic.h names are the machines' own.
Noto Sans Sinhala, Javanese, Balinese, Mongolian, Noto Serif Tibetan,
FreeSerif's Sinhala and Unifont's five shape as HarfBuzz does at 5,000
runs a plan; all installed fonts (1,748 plans) and 21 Noto fonts too.
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/design/004-text.md | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/docs/design/004-text.md b/docs/design/004-text.md index a681589..ec681e1 100644 --- a/docs/design/004-text.md +++ b/docs/design/004-text.md @@ -159,8 +159,9 @@ Malayalam은 psts와 rlig가 한 조회를 나눠 쓰는데, 안정 정렬로는 결과(Pi 5): -- 설치된 글꼴 213벌, 계획 1,688개에 각 1천 실행: 다른 실행 0(글자 모양이 비트맵뿐인 Noto Color Emoji는 심볼 단계에서 - 빠진다). 인도계가 있는 글꼴은 따로 계획마다 2만 실행: FreeSerif(여덟 문자), FreeSans, 굵은 꼴들, FreeMono, Unifont(아홉 +- 설치된 글꼴 213벌, 계획 1,748개에 각 1천 실행: 다른 실행 0(글자 모양이 비트맵뿐인 Noto Color Emoji는 심볼 단계에서 + 빠진다). 인터넷에서 받은 Noto 21벌(인도계 아홉, 싱할라, 크메르, 미얀마, 티베트, 자바, 발리, 몽골 등), 계획 80개에 각 3천 + 실행: 다른 실행 0. 인도계가 있는 글꼴은 따로 계획마다 2만 실행: FreeSerif(여덟 문자), FreeSans, 굵은 꼴들, FreeMono, Unifont(아홉 문자, GSUB 없음) 130개 계획 260만 실행, 다른 실행 0. - 새 규격 글꼴(dev2 등): 인터넷에서 받은 Noto Sans 아홉 벌(데바나가리부터 말라얄람까지), 계획마다 5천 실행, 다른 실행 0. - 속도: HarfBuzz의 1.25–1.3배 시간(Noto Sans Devanagari 문자당 1,614 대 1,235 ns, Tamil 674 대 526 ns). @@ -176,12 +177,31 @@ Malayalam은 psts와 rlig가 한 조회를 나눠 쓰는데, 안정 정렬로는 결과: Noto Sans Khmer와 Noto Sans Myanmar(인터넷에서 받은 OpenType 글꼴), 계획마다 2만 실행, 다른 실행 0. Unifont(GSUB 없음)의 두 문자도 0. 처음 돌린 검사에서 바로 맞았다. 음절 기계와 표를 HarfBuzz 원본에서 그대로 가져온 덕이다. +### 범용 셰이핑 엔진(USE): 싱할라, 티베트, 자바, 발리, 몽골 등 80여 문자 + +마이크로소프트의 USE 규격을 HarfBuzz가 옮긴 셰이퍼(`hb-ot-shaper-use.cc`)다. 범주 표는 HarfBuzz의 압축 표 +(`hb-ot-shaper-use-table.hh`, 유니코드 16)를 배열과 조회식 그대로 가져오고, 음절 기계는 앞의 생성기가 USE 문법을 컴파일한다 +(Ragel 기계와 10만 실행 비교에서 다른 음절 0). 생성기는 syllabic.h에 손으로 적은 범주 번호가 기계의 번호와 같은지 +`_Static_assert`로 컴파일할 때 확인한다. + +- 음절: 기계는 CGJ를 읽지 않고, 뒤에 부호가 오는 ZWNJ도 읽지 않는다. 읽지 않은 글리프는 앞 음절에 든다(맨 앞의 것은 음절 + 번호 0으로 남는다. HarfBuzz도 그렇다). +- rphf는 음절의 첫 세 글리프(인코딩된 repha면 그 하나)에만 걸고, 적용 뒤에 치환된 첫 글리프를 repha로 기록한다. pref가 + 만든 글리프는 앞 모음으로 기록한다. 그 사이마다 치환 표시를 지운다. +- 재배치: repha를 첫 뒤-기저 글리프 앞(없으면 끝)으로, 앞 모음을 음절 처음이나 마지막 halant 뒤로 옮긴다. +- 아랍처럼 잇는 문자(몽골, 응코 등)는 아랍의 연결 상태 기계로 형태를 고르고(몽골의 자유 이체 선택자는 앞 글자의 형태를 + 따른다), 나머지는 음절끼리 이어 isol·init·medi·fina를 고른다. +- 부호의 폭은 GPOS 앞에서 0으로 만든다. + +결과: Noto Sans Sinhala·Javanese·Balinese·Mongolian과 Noto Serif Tibetan, FreeSerif의 싱할라, Unifont의 다섯 문자, +계획마다 5천 실행, 다른 실행 0. Unifont의 몽골에서 한 번 달랐다. HarfBuzz 10.2의 기본 무시 문자 목록은 몽골 블록에서 +U+180B–180E만 넣고 네 번째 자유 이체 선택자(U+180F)를 빠뜨렸다. Vega는 유니코드대로 넣었었는데, HarfBuzz를 따라 뺐다. + 받지 않는 것(빌드 도구가 이유를 말하고 거부한다): - `kern` 표의 상태 기계(Apple 형식 1), 등급 형식(2, 3), 교차 방향 커닝. 설치된 글꼴의 `kern` 표는 모두 짝 형식(0)이다. - AAT 표(morx, kerx, trak), 늘이기(stch), 아랍 형태가 없어 HarfBuzz가 표시형으로 대체 셰이핑을 하는 글꼴(Unifont의 아랍). -- 기본·아랍·히브리·한글·인도계·크메르·미얀마 셰이퍼가 아닌 문자 체계: 태국·라오, USE 문자 체계들(싱할라, 티베트, 자바 - 등), 시리아. +- 기본·아랍·히브리·한글·인도계·크메르·미얀마·USE 셰이퍼가 아닌 문자 체계: 태국·라오, 시리아. - 이체 선택자(cmap 형식 14)는 싣지 않는다. 선택자는 숨기고 앞 글자는 기본 글리프로 둔다. ## 비례폭 글줄 |
