You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 1ca9177
Browse filesBrowse the repository at this point in the historyBrowse files
renderText: shape text in every script, bidirectional text, UAX #14 wrapping
A port of HarfBuzz 14.6's OpenType shaping (Old MIT, credited in the
file headers and THIRD_PARTY_NOTICES.md):
- buffer.ts: the in/out buffer with HarfBuzz's cluster merging
- layout.ts: GDEF, script/language/feature selection with feature
variations at the default instance, the feature map with stages and
masks, every GSUB (1-8) and GPOS (1-9) lookup type with HarfBuzz's
matching (ZWJ/ZWNJ, per-syllable, ligature components, mark
attachment to ligature components, cursive chains)
- shape.ts: unicode properties, dotted circles, native direction,
mirroring, normalization (decompose/reorder/recompose by what the
font has), fractions, space fallback, kern table, fallback mark
positioning, default ignorables
- shapers: Arabic (with presentation-form fallback and stch), Hebrew,
Thai/Lao, Hangul, Indic, Khmer, Myanmar and the Universal Shaping
Engine, their syllable grammars as longest-match NFA scanners
- scripts/unicode.js also generates the Indic/USE categories (after
HarfBuzz's generators, with Microsoft's USE data in scripts/ms-use),
canonical decompositions, Arabic presentation forms, vowel
constraints; property values are translated to short names
Identical to HarfBuzz (glyphs, clusters, positions) on the UDHR in 29
scripts, ~300,000 random sequences over 30 Noto fonts, 15,000 emoji
sequences in the color test fonts and 12,000 with the Latin test fonts.
renderText now analyzes each paragraph (UAX #9 levels, UAX #29
graphemes for font fallback, script itemization with paired brackets,
UAX #14 break opportunities), shapes runs of one level, script and font
with surrounding context, wraps at break opportunities (graphemes for
char wrapping and overlong words), and shapes and reorders every line
by itself (L1/L2). Hinted glyphs keep their hinted advances with the
positioning's adjustments rounded cumulatively. The old GSUB and GPOS
kerning code is removed.
Tests: tests/shaping.js compares 360 texts with HarfBuzz's output for
subsets of Noto fonts (scripts/shaping-reference.py), tests/unicode.js
adds GraphemeBreakTest, tests/font.js a bidirectional render test.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YJgRK5qpwJEbHPuFv6kgAQ
@@ -103,7 +104,9 @@ The JPEG codec is based in part on the work of the Independent JPEG Group (libjp
103
104
[pdf.js](https://github.com/mozilla/pdf.js), the glyph rasterizer is translated from
104
105
[font-rs](https://github.com/raphlinus/font-rs). The WebP codecs follow [RFC 9649](https://www.rfc-editor.org/rfc/rfc9649) and [RFC 6386](https://www.rfc-editor.org/rfc/rfc6386)
105
106
and reproduce [libwebp](https://chromium.googlesource.com/webm/libwebp)'s color conversion, the TrueType hinting follows
|[HarfBuzz](https://github.com/harfbuzz/harfbuzz)|`src/render/buffer.ts`, `src/render/layout.ts`, `src/render/shape.ts`, `src/render/shapers/*` (OpenType shaping: buffer, GSUB/GPOS, normalization, fallback positioning, the script shapers and syllable grammars), `scripts/unicode.js` (shaping category tables) | Old MIT |
19
+
|[Universal Shaping Engine data](https://github.com/harfbuzz/harfbuzz/tree/main/src/ms-use) by Microsoft |`scripts/ms-use` (category overrides, invalid vowel sequences), the tables generated from them in `src/render/unicode-data.ts`| MIT |
18
20
|[Unicode Character Database](https://www.unicode.org/ucd/)|`src/render/unicode-data.ts` (character properties, generated by `scripts/unicode.js`) | Unicode License v3 |
0 commit comments