feat: RTL (Arabic/Hebrew) text rendering and layout#745
Open
fjobeir wants to merge 3 commits intovercel:mainfrom
Open
feat: RTL (Arabic/Hebrew) text rendering and layout#745fjobeir wants to merge 3 commits intovercel:mainfrom
fjobeir wants to merge 3 commits intovercel:mainfrom
Conversation
- Update @shuding/opentype.js to fork with Context Substitution Format 3 fix - Add RTL text detection for Arabic/Hebrew Unicode ranges - Enable text alignment for single-line RTL text with right-align default - Force full-line accumulation for RTL to let Bidi engine handle word ordering - Compute precise RTL alignment using measured text width after shaping - Update test snapshots for corrected Arabic text rendering https://claude.ai/code/session_0192MAXgejpjkKBgChuyTFcd
Keep @shuding/opentype.js at 1.4.0-beta.0 (the published version). The opentype.js Context Substitution Format 3 fix is tracked separately in opentypejs/opentype.js#824. Restore webkit-text-stroke snapshots to match the published dependency. https://claude.ai/code/session_0192MAXgejpjkKBgChuyTFcd
Fix RTL (Arabic/Hebrew) text rendering and layout
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
text-align: left,center,justify)lineWidths.length > 1)Motivation
RTL text (Arabic/Hebrew) in Satori-based OG image generation was broken in two ways:
Note: This PR addresses issue 2 (layout). Issue 1 (opentype.js crash) is tracked separately in opentypejs/opentype.js#824 — once merged and published, the
@shuding/opentype.jsdependency version should be bumped.Test plan
npx vitest run)text-align: left,center,justifyoverrides respected for RTL text