Skip to content

fix: retain combining marks with their RTL base characters - #13

Merged
xclud merged 9 commits into
olutter:mainfrom
palmoni5:codex/upstream-bidi-marks
Nov 14, 2026
Merged

xclud merged 9 commits into
olutter:mainfrom
palmoni5:codex/upstream-bidi-marks

Conversation

@palmoni5

Copy link
Copy Markdown
Contributor

Problem and resulting behavior

Reversing RTL runs also reversed nonspacing marks independently of their base letters. For logical א\u05B0ב\u05B1ג, the old output code points were [1490, 1457, 1489, 1456, 1488], attaching marks to the wrong bases. The fixed output is [1490, 1489, 1457, 1488, 1456], preserving each base-plus-mark cluster while retaining original source indices.

Restore L3 cluster order after visual run reversal, and recognize nonspacing marks introduced during decomposition. LTR accents continue through the existing normalization behavior. The implementation uses private helpers; no public API or version changes.

Validation

  • Reproduced the preceding before/after example directly against upstream main (ebef4fb) and this branch.
  • flutter analyze: no issues, including the benchmark and Flutter example.
  • dart test: all 6 tests pass. Regressions cover single and multiple Hebrew marks, RTL clusters inside Latin paragraphs and LTR accent normalization.
  • dart run benchmark/bidi_benchmark.dart: smoke benchmark passes; the existing benchmark remains in CI.

This PR is independently based on upstream main and contains only the combining-mark correction, its regressions and complete static-analysis CI. Performance, scalar handling, source mappings and bracket resolution are separate submissions.

@Y-PLONI

Y-PLONI commented Nov 12, 2026

Copy link
Copy Markdown

בבדיקת צרכן PDF אמיתי נמצא שסידור L3 תלוי במנוע הציור, כפי שמצוין ב־Unicode L3. dart_pdf מצייר גליפים ישירות ומשתמש בניקוד RTL הבולט ימינה; החלת L3 ללא בחירה מפורשת מזיזה ניקוד לאות אחרת.

הכנתי תיקון המשך המבוסס ישירות על head הנוכחי של PR זה. הוא מוסיף RtlCombiningMarkOrder מפורש, שומר כברירת מחדל את beforeBase לתאימות, ומאפשר afterBase למנוע שמצפה לצירוף אות וסימנים. בדיקות L3 הקיימות שומרות את אותן תוצאות צפויות ובוחרות במפורש afterBase. כל 9 בדיקות הענף ו־dart analyze עברו. בשילוב עם שאר תיקוני הפורק, PDF מרונדר בשש דוגמאות זהה ברמת הפיקסלים לגרסת הבסיס.

לא הייתה הרשאת כתיבה זמינה לענף המקורי ב־palmoni5/bidi, ולכן התיקון פורסם ב־ענף הארגון לצורך יישום באותו PR. הענף המקורי לא שונה ולא נפתח PR כפול.

@xclud
xclud merged commit 5054dd8 into olutter:main Nov 14, 2026
1 check failed
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.

3 participants