harfbuzz-subset.wasm has a fixed 65 MiB heap; instancing a large variable font silently drops `gvar`
@khaledhosny がすでに取り組んでいます。
2026年11月1日 から。
評価
- 難易度
- 4/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 55/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- javascript, typescript, wasm
- 領域
- backend, performance
調査の方向性
Start by inspecting the build configuration and generated dist/harfbuzz-subset.wasm memory limits, then compare its heap behavior with dist/harfbuzz.wasm. Reproduce using the reported Material Symbols font and pinned axes, checking whether the output retains gvar. Done means large variable font subsetting either preserves gvar or fails with a clear error instead of silently dropping it.
索引モデルが issue の本文から書いたものです。
説明
What happens
Pinning any axis of a large variable font with harfbuzz-subset.wasm returns a font without a gvar table. hb_subset_or_fail succeeds and nothing reports an error, so the result looks valid but has lost every outline variation of the remaining axes.
How to reproduce
- harfbuzzjs 1.6.4 (HarfBuzz 15.0.0); 1.6.3 (HarfBuzz 14.6.0) behaves the same.
- Font:
material-symbols-outlined.woff2from the npm package[email protected]. It is 10 MiB as TTF, with a 9.3 MiBgvar, and has the axes FILL, GRAD, opsz and wght. - Subset with all unicodes,
--layout-features=*, and pinwght=400 GRAD=0 opsz=24. The same happens when pinning only one of them.
| Build | Output | gvar |
|---|---|---|
native hb-subset 14.6.0, same options |
1,490,672 bytes | kept, glyphs identical to the original |
harfbuzzjs 1.6.3 harfbuzz-subset.wasm |
1,290,140 bytes | missing |
| harfbuzzjs, no axis pinned | 10.6 MB | kept |
harfbuzzjs, pinning, subset to the text home |
2 KB | kept |
| hb-subset-wasm (HarfBuzz in wasm32, heap growable to 256 MiB) | 1,490,620 bytes | kept, glyphs identical to the original |
Cause
The memory section of dist/harfbuzz-subset.wasm declares min = max = 1040 pages (65 MiB), so the heap cannot grow. dist/harfbuzz.wasm, the Emscripten build, grows through _emscripten_resize_heap. Another wasm32 build of the same HarfBuzz with a growable heap keeps gvar, so the instancer appears to run out of memory and the table is dropped instead of the subset failing. Raising only the declared maximum of the existing binary did not help, so the allocator in that build also seems unable to grow.
#39 asked for a growable heap and was closed when harfbuzzjs moved to Emscripten. The separate subset build seems to have brought the fixed heap back.
Effect
Downstream, subset-font with variationAxes returns broken fonts for large variable fonts without any warning. With Material Symbols, 14 icons drawn with FILL 1 lose their fill, because those fills come from gvar deltas rather than from substituted glyphs.
Suggestions
- Build
harfbuzz-subset.wasmwith a growable heap, as the main build is. - Make running out of memory while subsetting a table fail
hb_subset_or_failinstead of dropping the table. If that is HarfBuzz behaviour rather than harfbuzzjs behaviour, I can file it there as well.
- 主要言語
- TypeScript
- スター
- 297
- フォーク
- 53
- 平均マージ
- 36分
- マージ済み PR(30日)
- 1
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
harfbuzz/harfbuzzjs のほかの issue
-
Opt-in destroy() alongside FinalizationRegistry?対応中かも @dannyball710 が 48 日前に担当しました。 オープン
難易度 4/5 3〜5日 初心者へのやさしさ 20/100
harfbuzz/harfbuzzjs#239 · コメント 4 件 ·
harfbuzz/harfbuzzjs の issue をすべて見る
似ている issue
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
ardia-browser/ardia#5810 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 73/100
SocialGouv/egapro#5329 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 69/100
activepieces/activepieces#17974 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
OHDSI/Data2Evidence#3777 ·
メンテナーはふだん 3 日以内に返信