Skip to content

Fix Director text decoding and leading whitespace layout - #235

Open
luismgl wants to merge 6 commits into
igorlira:mainfrom
luismgl:fix/director-text-decoding-layout
Open

Fix Director text decoding and leading whitespace layout#235
luismgl wants to merge 6 commits into
igorlira:mainfrom
luismgl:fix/director-text-decoding-layout

Conversation

@luismgl

@luismgl luismgl commented Aug 25, 2026

Copy link
Copy Markdown

Summary

  • Decode XMED text using the platform declared by each Director file: Mac Roman for platform 1 and Windows-1252 otherwise.
  • Preserve valid UTF-8 before applying the legacy single-byte fallback.
  • Propagate the encoding through internal and external cast loading and the JS chunk-inspection path.
  • Preserve authored leading whitespace in styled PFR text layout so its advance contributes to glyph positioning.

Rationale

Classic Mac Director movies can store accented text as Mac Roman bytes. Treating those bytes as Windows-1252 produces incorrect glyphs. Separately, some Director text members use leading whitespace as authored positioning inside the member rectangle; dropping it collapses otherwise distinct glyph runs onto the same origin.

Both changes are format/runtime rules and do not alter the public polyfill API or rely on movie names, member IDs, or character heuristics.

Validation

  • Rust tests cover Mac Roman and Windows-1252 critical bytes, ASCII, valid UTF-8, platform selection, and leading-whitespace advances.
  • npm run build-vm
  • npm run build-polyfill
  • Browser validation with DPR 2 and a 1024x550 logical canvas confirmed corrected accented text, preserved initial text spacing, unchanged final-grid layout, keyboard progression, and hover behavior.

@chameleonxxl

Copy link
Copy Markdown
Collaborator

For which movie did you make those changes?

Would be good to know in order to test it properly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants