Repository navigation
Find complex-script text the scan missed before drawing it with rhwp - #1131
Merged
Merged
Conversation
…rhwp rhwp draws Arabic and Persian unjoined and backwards, so a document with such text must take another route or be refused. The scan that decides this missed text that still reaches the PDF, which came out unreadable: - the text of an Excel number format (#,##0 "ریال"), read from the cells that use it, because Excel also keeps formats nobody uses - text in XML character references (گ) in any Office package - text boxes on a PowerPoint master or layout, whose placeholder prompts are never drawn and don't count - .potm presentations, which weren't scanned as presentations at all Refs #881 Refs #979 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Refs #881
Refs #979
Cause
rhwp draws Arabic and Persian unjoined and backwards, so
ComplexScriptsscans a document first: with such text it takes a route through LibreOffice, or is refused with the reason. The scan missed text that still reaches the PDF, and that text came out unreadable:#,##0 "ریال")ریالdrawn unjoined and backwardsگ), any Office packageالبطولة المفتوحةunjoined, overlapping and backwards.potmThe first and third match what #881 and #979 describe, but neither report has a file attached, so I can't say these were the reporters' cases. That is why this is
Refs.Fix
xl/styles.xmlhas such letters in a format, the cells are read as they are shown, as already done for.xls. Excel keeps the currency formats of its language in files that don't use them, so a format nobody uses doesn't reroute or refuse a document..potmis scanned as a presentation.The widths question uses the same scan, so a Cyrillic number format now also takes a route without rhwp when there is one.
What this doesn't change
Without LibreOffice these files are now refused with the existing "needs LibreOffice" message instead of being written broken. With LibreOffice, a Persian sheet and an Arabic slide render shaped and in the right order (checked on Windows with 26.2.6, rendered and looked at). Making rhwp itself draw them isn't reasonable. I tried handing it pre-shaped text: presentation forms in visual order, directly in an HWPX. The forms and the order come out right, but rhwp has no widths for these letters and sets each at a fixed half-em, so they stand apart with gaps and overlaps instead of joining. It also breaks lines left to right, so a wrapped paragraph would have its lines in the wrong order.
How this was checked
ArabicSheetTests: 5 new test cases fail withmain's scan. The route testA_persian_number_format_is_never_drawn_unshapedskips here without rhwp in the test folder and should run in CI.h_refs,h_numfmtandh_master, and still converts a workbook with only a Persian sheet name, which isn't drawn.🤖 Generated with Claude Code