Skip to content

Port Hufnagel font switching to production Verovio worker#1376

Open
zih-syuan wants to merge 22 commits into
developfrom
zih-syuan/hufnagel-ui
Open

Port Hufnagel font switching to production Verovio worker#1376
zih-syuan wants to merge 22 commits into
developfrom
zih-syuan/hufnagel-ui

Conversation

@zih-syuan

Copy link
Copy Markdown

Related issues

Related to #1367 (font switching implemented; dropdown-freeze and switch-warning behavior still open for discussion, not closed by this PR)
Closes #1368

What this does

  • Ports the Hufnagel/Bravura(Square notation) font-switching logic (fetchHufnagelBase64, setFont case) from VerovioWorker-dev.js to the production worker VerovioWorker.js, so the feature actually works once live on neon.simssa.ca.
  • INSERT panel icons now render dynamically instead of using static PNGs.

Testing

  • yarn cypress:test: all passing (44 passing, 6 pending — unrelated to this change)
  • Manual local test: confirmed via browser DevTools Network/Console that VerovioWorker.js (not the dev version) loads, and Hufnagel font renders correctly

zih-syuan and others added 22 commits June 12, 2026 12:47
diva.js#master no longer exists; pin to last known good commit.
See #1365.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Adds assets/Hufnagel.zip for Verovio fontAddCustom integration.
Font source files live in zih-syuan/hufnagel-font; this branch
only tracks the packaged artifact.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Adds a Square/Hufnagel selector below Display Options. Clicking updates
the label and logs to console; engine wiring (setFont / setNotationType)
is the next step.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- VerovioWorker: add setFont handler (lazy-loads Hufnagel.zip as base64,
  calls toolkit.setOptions with full options)
- NeonCore: add setNotationFont() — sends setFont to worker, clears
  lastPageLoaded to bypass cache on next render
- NeonView: add setNotationType() — calls setNotationFont then re-renders
- DisplayControls/DisplayPanel: thread neonView through setDisplayListeners
  → initDisplayControls → setNotationTypeControls so dropdown is wired
- Interfaces/SingleView/DivaView: update setDisplayListeners signature

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…fallback

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
E99F is absent from Hufnagel.zip so Bravura fallback showed a square
notation glyph. Generate a two-diamond icon via Verovio and use it as
pngFallback for the distropha button in Hufnagel mode.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…back

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Verovio segfaults on staffDef notationtype="neume.hufnagel" (and
"neume.square" is unverified) and doesn't render @con, so canonical
Hufnagel connections (@con="e") and the real notationtype must never
reach the Verovio worker directly. Add a temporary conversion shim in
ConvertMei.ts (stripHufnagelForVerovio / restoreHufnagelForStorage)
applied unconditionally at the two real boundaries - NeonCore.loadData()
before anything reaches Verovio, and NeonCore.updateDatabase()/save()/
export() before anything is persisted or downloaded - so every load
path (fresh fetch, cache hit, undo, redo) and every persistence path
(save, export, download) stays consistent. See issues #1360, #1366.

Co-Authored-By: Claude <noreply@anthropic.com>
Drop the hufnagel liquescent down primitive and the alternate F clef
variant (fClefHufnagel) from the Insert panel, leaving one F clef
button shared with square notation.
Nudge virga, virgaReversed, and custos icon offsets in the Insert
panel so they align visually with the rest of the hufnagel primitives.
…handling

- Upload modal now has a Notation Type choice, written into the MEI and
  synced to the Editing page dropdown.
- Removed the auto con->ligated conversion before Verovio; it was
  corrupting real content. @con now passes through untouched.
- Save no longer converts @ligated back to @con (only Download does),
  so a manually toggled connection survives a reload.

Co-Authored-By: Claude <noreply@anthropic.com>
@zih-syuan zih-syuan requested a review from kyrieb-ekat July 7, 2026 17:03
@lpugin

lpugin commented Jul 8, 2026

Copy link
Copy Markdown
Member

Is this still using the Verovio version from RISM Digital with no modification?

@zih-syuan

Copy link
Copy Markdown
Author

Yes, this still uses the unmodified Verovio build from RISM Digital. This PR only changes how Neon configures the toolkit: for Hufnagel, it loads the custom font through Verovio's existing fontAddCustom option.

For @con, Neon currently uses a temporary workaround: it maps Hufnagel connections to @ligated before sending the MEI to Verovio, then maps them back to @con before saving/exporting. The saved MEI should still be correct, but the Verovio-facing path is still a shortcut, and I am going to replace it with proper @con handling.

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.

Update INSERT panel icons for Hufnagel notation

3 participants