fix(rtl): the preview's frame data keeps its fields in order; charts keep European digits
The right-to-left separator broke the frame data over the preview, a left-to-right
island: after the localized time ("6:03:41 م") the shutter's number read as part
of the previous field and swapped places with the dot. Fields shown in such an
island now use Loc.IslandSeparator, with left-to-right marks in right-to-left
languages. Charts formatted text with the UI culture's digit substitution, so a
number after Arabic words came out in Arabic-Indic digits there only; they now
draw European digits like every text block. The direction marks in source are
written as escapes instead of invisible characters.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC
This commit is contained in:
11 files changed
+39
-16
No files matched your search
@@ -1,4 +1,5 @@
|
||||
using System.Collections.Specialized;
|
||||
using System.Globalization;
|
||||
using System.Windows;
|
||||
using System.Windows.Automation;
|
||||
using System.Windows.Automation.Peers;
|
||||
@@ -398,10 +399,16 @@ public abstract class DrawingElement : FrameworkElement
|
||||
|
||||
protected override AutomationPeer OnCreateAutomationPeer() => new DrawingElementAutomationPeer(this);
|
||||
|
||||
/// <summary>
|
||||
/// Digits as the rest of the UI shows them: with the UI culture alone, Arabic text before a number would turn its
|
||||
/// digits into Arabic-Indic ones in charts only.
|
||||
/// </summary>
|
||||
private static readonly NumberSubstitution EuropeanDigits = new(NumberCultureSource.Override, CultureInfo.InvariantCulture, NumberSubstitutionMethod.European);
|
||||
|
||||
private FormattedText Format(string text, double emSize, Brush brush, bool semiBold, FlowDirection direction)
|
||||
{
|
||||
var typeface = semiBold ? _semiBold ??= CreateTypeface(FontWeights.SemiBold) : _regular ??= CreateTypeface(FontWeights.Normal);
|
||||
return new FormattedText(text, Loc.Culture, direction, typeface, emSize, brush, null,
|
||||
return new FormattedText(text, Loc.Culture, direction, typeface, emSize, brush, EuropeanDigits,
|
||||
TextOptions.GetTextFormattingMode(this), VisualTreeHelper.GetDpi(this).PixelsPerDip);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user