Skip to content

Switch Thai font from Sarabun to Boon and refactor cell coloring - #26

Closed
narze wants to merge 1 commit into
mainfrom
claude/stoic-ritchie-d8bolw
Closed

Switch Thai font from Sarabun to Boon and refactor cell coloring#26
narze wants to merge 1 commit into
mainfrom
claude/stoic-ritchie-d8bolw

Conversation

@narze

@narze narze commented Jun 16, 2026

Copy link
Copy Markdown
Member

Summary

This PR replaces the Sarabun font with Boon (a modified Thai face from manoonchai/manoontype) and refactors the typing flow cell coloring logic to match manoontype's per-keystroke highlighting behavior.

Key Changes

  • Font Migration: Replaced Sarabun with self-hosted Boon font

    • Added @font-face declaration for Boon-400.woff2 with GPOS mark positioning support
    • Updated font references in app.css, result-card.ts, and +layout.svelte
    • Removed @fontsource/sarabun dependency
  • Cell Coloring Refactor: Changed from cluster-based to code-point-based coloring

    • Removed clustersOf() dependency and cluster iteration logic
    • Each code point now lights the instant it is typed (matching manoontype behavior)
    • Simplified state logic: code points are colored as CORRECT, WRONG, or CURRENT_PENDING based on individual keystroke matching
    • Thai combining marks (tone marks, vowels) are now their own cells that light independently when typed
  • Test Updates: Updated test expectations to reflect per-keystroke coloring

    • Changed test name from "keeps a partly-typed cluster muted" to "lights each code point the instant it is typed"
    • Updated assertions: base consonant now lights immediately when typed, while tone marks and vowels remain muted until their own keystrokes land

Implementation Details

The refactored activeCells logic now iterates through target code points directly rather than grapheme clusters. Each code point's color is determined by:

  • CURRENT_PENDING: Not yet reached in input
  • CORRECT: Input matches the expected code point
  • WRONG: Input differs from expected code point

Boon's GPOS mark positioning ensures Thai combining marks still stack correctly onto their base consonants despite being in separate inline <span> elements, enabling proper per-keystroke visual feedback.

https://claude.ai/code/session_01Gizdi8AgrkJ2JiGMEdPPpw

Replace self-hosted Sarabun with Boon — the modified Thai face manoontype
ships — served as a single self-hosted 400 weight (heavier UI text
synthesises bold from it, exactly as manoontype does).

With Boon's full GPOS mark positioning, the active word goes back to the
manoontype model: one cell per code point, each lighting the instant it is
typed (correct / wrong / pending), caret between code points. Because the
cells stay display:inline, Boon shapes the whole word as one run and stacks
every tone mark / vowel onto its base — even when a mark and its base carry
different colours (ที่, not ที). This drops the per-cluster "light only when
fully typed" workaround, so a base no longer waits on its vowel to light, and
a vowel never looks typed the instant its base is pressed.

Verified in headless Chromium: typing บ with a pending ี renders the ี muted
but stacked on a lit บ, no dotted circles.

https://claude.ai/code/session_01Gizdi8AgrkJ2JiGMEdPPpw
@vercel

vercel Bot commented Jun 16, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
learn-manoonchai Ready Ready Preview, Comment Jun 16, 2026 10:44am

Request Review

@narze narze closed this Jun 16, 2026
@narze
narze deleted the claude/stoic-ritchie-d8bolw branch June 16, 2026 10:53
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.

2 participants