Skip to content

Skia: right-to-left text that ends with a number/Latin run is shaped in the wrong direction (bidi runs collected in visual order, consumed as logical) #25979

Open

Description

@akshazy

Current behavior 🐛

On the Skia desktop head (seen on macOS, Uno.Sdk 6.7.30), an Arabic-script string in a right-to-left
paragraph that ends with a left-to-right run (a number or a Latin word) is shaped in the wrong direction:
the first letter of the Arabic text breaks off from the rest of the word.

  • نیا چاند 1 → ن is drawn detached from یا
  • پیر 9 → پ is drawn detached from یر
  • منگل 3 نومبر 2026 · 14:58 → broken
  • عقرب میں نیا چاند (no trailing number) → correct
  • 10 اکتوبر (number first) → correct

Expected behavior 🎯

Same shaping as without the trailing number (all letters joined), as on WinUI.

How to reproduce it (as minimally and precisely as possible) 🔬

<StackPanel FlowDirection="RightToLeft">
    <TextBlock FontSize="32" Text="نیا چاند 1" />   <!-- broken -->
    <TextBlock FontSize="32" Text="عقرب میں نیا چاند" />   <!-- correct -->
</StackPanel>

Any font with Arabic coverage reproduces it (tested with Geeza Pro and Noto Sans Arabic UI).

Workaround 🛠️

Build _bidiBreaks in logical order, e.g. with ubidi_getLogicalRun:

for (int pos = 0; pos < _text.Length; )
{
    ICU.GetMethod<ICU.ubidi_getLogicalRun>()(bidi, pos, out var limit, out var level);
    _bidiBreaks.Add((limit, (level & 1) == 1 ? FlowDirection.RightToLeft : FlowDirection.LeftToRight));
    pos = limit;
}

or simply sort _bidiBreaks by end before EnumerateShapingRuns. We are currently applying the latter
as a runtime workaround (Harmony prefix on EnumerateShapingRuns that sorts bidiBreaks), which fixes
every case above.

Affected platforms 📱💻🖥️

No response

Uno.Sdk version (and other relevant versions) 📦

  • Uno.Sdk 6.7.30, net10.0-desktop (Skia), macOS 27.2, Apple Silicon
  • Also present in release/stable/6.7 and master source as of November 2026

IDE version 🧑‍💻

No response

Anything else we need to know? 💬

Visual Studio Code 1.144.0 (C# Dev Kit 3.40.215, Uno Platform extension 0.26.2). IDE-independent: also reproduces with dotnet run -f net10.0-desktop from Terminal.

Activity

  1. added
    triage/untriaged
    on Nov 3, 2026
  2. added theissue type on Nov 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    triage/untriaged

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions