Skip to content

Use WebAssembly.instantiate in the browser - #9

Closed
Liamolucko wants to merge 4 commits into
imagescript:browserfrom
Liamolucko:instantiate
Closed

Liamolucko wants to merge 4 commits into
imagescript:browserfrom
Liamolucko:instantiate

Conversation

@Liamolucko

Copy link
Copy Markdown

WebAssembly.instantiate() compiles the WebAssembly on another thread, meaning you don't have to use a Worker.

@matmen matmen added the enhancement New feature or request label Jan 13, 2021
@matmen

matmen commented Jan 14, 2021

Copy link
Copy Markdown
Collaborator

I kinda liked the idea of having it run in another thread, but i guess people can still just move it to a WorkerThread.
I'll write some tests for the browser branch when im back home and then merge it. Cheers

matmen added a commit that referenced this pull request Jan 24, 2021
@matmen

matmen commented Jan 24, 2021

Copy link
Copy Markdown
Collaborator

merged in 23e4081

@matmen matmen closed this Jan 24, 2021
@Liamolucko
Liamolucko deleted the instantiate branch January 24, 2021 21:21
matmen added a commit that referenced this pull request Oct 16, 2026
Groundwork for text in any script, not used by renderText yet:
- scripts/unicode.js generates src/render/unicode-data.ts from the
  Unicode Character Database 18.0 (general category, combining class,
  bidi class, brackets and mirroring, line break, East Asian width,
  script, grapheme break, Indic conjunct break, Extended_Pictographic,
  Indic syllabic/positional categories, joining type): varint encoded
  ranges in base64, 67 kB (27 kB gzipped), decoded when first used
  (src/render/unicode.ts)
- src/render/bidi.ts: UAX #9, written after the specification (P2-P3,
  X1-X10, W1-W7, N0 brackets, N1-N2, I1-I2, L1-L2); passes all 770,241
  BidiTest.txt and 91,707 BidiCharacterTest.txt cases
- src/render/linebreak.ts: UAX #14 revision 57 (LB1-LB31, LB15a-d, LB20a,
  LB21a-b, LB28a, LB30a-b); passes all 19,346 LineBreakTest.txt cases
- tests/unicode.js runs samples of the three conformance files
- Unicode License v3 in licenses/ and THIRD_PARTY_NOTICES.md

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YJgRK5qpwJEbHPuFv6kgAQ
matmen added a commit that referenced this pull request Oct 17, 2026
…rapping

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants