Skip to content

fix: fix thai script diacritics (upper vowel + tone mark stacking - สระจม)#748

Open
betich wants to merge 3 commits intovercel:mainfrom
betich:fix-thai-script-diacritics
Open

fix: fix thai script diacritics (upper vowel + tone mark stacking - สระจม)#748
betich wants to merge 3 commits intovercel:mainfrom
betich:fix-thai-script-diacritics

Conversation

@betich
Copy link
Copy Markdown

@betich betich commented Apr 6, 2026

Fixes Thai diacritics appearing below as mentioned in #668

Case Before After
เยิ้ม (Prompt) thai-yeum-prompt-before thai-yeum-prompt-after
ลิ้น (Prompt) thai-lin-prompt-before thai-lin-prompt-after
เยิ้ม (Noto Sans Thai) thai-yeum-noto-sans-thai-before thai-yeum-noto-sans-thai-after
ลิ้น (Noto Sans Thai) thai-lin-noto-sans-thai-before thai-lin-noto-sans-thai-after

The code lifts Thai tone upper marks (like ้) to avoid clashing with other upper vowel marks (like ิ).

  • Added helper functions (isThaiCodePoint, isThaiCombiningMark, isThaiAboveMark, isThaiToneMark) to classify Thai Unicode code points and identify combining marks and their types.
  • Implemented logic to track and adjust the vertical stacking of Thai upper marks and tone marks, ensuring that tone marks are shifted upwards as needed to avoid overlapping with other marks. [1] [2]
  • Extracted the glyph path translation logic into a reusable translatePath function, simplifying and clarifying how glyph paths are shifted in the rendering process. [1] [2]

@betich betich requested a review from shuding as a code owner April 6, 2026 05:54
@vercel
Copy link
Copy Markdown
Contributor

vercel Bot commented Apr 6, 2026

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

Project Deployment Actions Updated (UTC)
satori-playground Ready Ready Preview, Comment, Open in v0 Apr 6, 2026 6:14am

@betich betich changed the title Fix thai script diacritics (สระจม) fix: fix thai script diacritics (สระจม) Apr 6, 2026
Comment thread src/font.ts
@betich betich changed the title fix: fix thai script diacritics (สระจม) fix: fix thai script diacritics (upper vowel + tone mark stacking - สระจม) Apr 6, 2026
@betich
Copy link
Copy Markdown
Author

betich commented Apr 6, 2026

Hi @shuding, this PR fixes Thai diacritics rendering issues (upper vowel + tone mark stacking) which I encountered while using this library with Thai scripts.

Would appreciate any feedback when you have time 🙏

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