Skip to content

fix(unencoded): bundle custom-forms.json.gz asset and resolve custom-component subtractions - #1087

Merged
mkpoli merged 1 commit into
mainfrom
fix/unencoded-custom-forms-asset
Dec 1, 2026
Merged

mkpoli merged 1 commit into
mainfrom
fix/unencoded-custom-forms-asset

Conversation

@mkpoli

@mkpoli mkpoli commented Dec 1, 2026 •

Copy link
Copy Markdown
Owner

TL;DR Custom-forms asset bundling: bundles custom-forms.json.gz in demo/vite.config.js (ENGINE_OUTLINES), scripts/og-assets.mjs, and worker/render.js, and resolves custom-component subtractions (such as ㇯雋隹 for X-00033) via custom.drawable('&X-…;') in Unencoded.svelte.

ELI5 On unencoded.html, components like X-00033 ({33} / &CDP-8DDF; / ㇯雋隹) showed blank dashes across all six font faces and no positional cuts. Two causes combined: demo/vite.config.js did not include custom-forms.json.gz in ENGINE_OUTLINES, so cutForms never loaded at runtime, and Unencoded.svelte tried to compose ㇯雋隹 raw (which fails with an approximate subtraction) instead of resolving &X-00033; through custom.drawable.

flowchart LR
  A["Unencoded component X-00033"] --> B["Load bundled custom-forms.json.gz"]
  B --> C["Render Sans and Serif cuts and positional hosts"]
  A --> D["Resolve &X-00033; via custom.drawable"]
  D --> E["Render Woodblock, Fangsong, Regular, Pen"]
Loading

Root cause

  1. demo/vite.config.js omitted custom-forms.json.gz from ENGINE_OUTLINES (and scripts/og-assets.mjs / worker/render.js omitted it from OG assets), so engineOutlines['custom-forms.json.gz'] was undefined at runtime.
  2. fallbackSequenceOf(row) in demo/Unencoded.svelte fell straight through to raw row.subtractions[0] (㇯雋隹), which han-compose cannot subtract cleanly because 雋 has no encoded-only decomposition, instead of resolving &X-00033; via custom.drawable().

Screenshots

Light Dark
light dark

Checked

  • bun run check (tsrs + svelte-check: 0 errors, 0 warnings)
  • bun run lint (oxlint: 0 errors)
  • bun run i18n (x18n check passed)
  • bun run build:demo (emits dist/assets/custom-forms.json.gz)
  • Visual verification in headless Chromium (2× light and dark screenshots on unencoded.html?q=X-00033)

Summary by CodeRabbit

  • Bug Fixes
    • Improved rendering for rows whose existing shown-form sequence cannot be used. A valid custom form for the row’s identifier can now be displayed, while the existing fallback remains available when the custom form is unsuitable.
  • Improvements
    • Added the custom-form data asset to the demo’s available rendering resources.

@coderabbitai

coderabbitai Bot commented Dec 1, 2026 •

Copy link
Copy Markdown

Explain Change →

Walkthrough

The change adds custom-forms.json.gz to the demo asset list, asset build, and worker asset matcher. The row identifier fallback now tries its custom drawable when the shown form cannot be used directly.

Changes: Custom Forms

Layer / File(s) Summary
Custom forms asset delivery
demo/vite.config.js, scripts/og-assets.mjs, worker/render.js
The demo asset list and worker matcher include custom-forms.json.gz. The asset build copies it into data and reports it in the copy log.
Custom drawable fallback
demo/Unencoded.svelte
When the shown-form text cannot be used directly, fallbackSequenceOf tries the row identifier’s custom drawable. It accepts the result only if it differs from the identifier and parses without errors or remaining custom components. Otherwise, it continues to the existing subtraction fallback.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Pre-merge checks: Passed 2

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title names the two changes in the PR: bundling the custom-forms.json.gz asset and resolving custom-component subtractions in Unencoded.svelte. The raw summary confirms both: the asset is added to…
Full details: Title check

Explanation

The title names the two changes in the PR: bundling the custom-forms.json.gz asset and resolving custom-component subtractions in Unencoded.svelte. The raw summary confirms both: the asset is added to ENGINE_OUTLINES, the og-assets copy list, and the loadFor matcher, and fallbackSequenceOf now resolves custom forms. The title is specific and matches the changeset. It is slightly long at 91 characters, but it is still clear.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@mkpoli
mkpoli merged commit 97e5444 into main Dec 1, 2026
0 of 2 checks passed
@mkpoli
mkpoli deleted the fix/unencoded-custom-forms-asset branch December 1, 2026 14:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant