Repository navigation
Edit Arabic text and keep it readable after saving - #87
Merged
Merged
Conversation
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.
Problem
In Edit mode, a reader could select an existing Arabic heading but could not change it. Some PDFs paint each glyph separately and use a single glyph for several letters. Reading those objects in painting order scrambles the text.
Change
Edit mode reads Arabic runs in logical order, including the PDF’s tagged text for ligatures. The inline editor uses the line’s right edge. Saved edits use a subset of an offline DejaVu font with contextual shaping and positioned diacritics. The replacement remains searchable, selectable, and editable after reopening the PDF. Other right-to-left scripts keep their existing protection.
Issue or approval
Closes #49.
How I checked it
On macOS I edited the heading in the reporter’s PDF, saved a copy, reopened it, and verified the new Arabic text. The cross-platform smoke test uses a synthetic PDF. It inserts a marked Arabic greeting with digits, deletes a word from a second line, checks the saved PDF’s extracted text, and edits the saved copy again.
TypeScript, the production build, 259 unit tests, the text-direction tests, and the hidden desktop smoke suite passed locally. The PR workflow runs on Windows, macOS, and Linux.
Implemented and tested by GPT-6 in OpenAI Codex.