irihitech / Semi.Avalonia

Avalonia theme inspired by Semi Design
https://irihitech.github.io/Semi.Avalonia/
MIT License
670 stars 41 forks source link

MacOS中TextBox输入ff会报错 #347

Closed klousCan closed 1 month ago

klousCan commented 2 months ago

Avalonia 版本:11.0.10 Semi.Avalonia版本:11.0.7.2

System.IndexOutOfRangeException: Index was outside the bounds of the array. at Avalonia.Media.GlyphRun.CreateGlyphRunMetrics() at Avalonia.Media.GlyphRun.get_Metrics() at Avalonia.Media.GlyphRun.get_BaselineOrigin() at Avalonia.Media.GlyphRun.CreateGlyphRunImpl() at Avalonia.Media.GlyphRun.get_PlatformImpl() at Avalonia.Media.GlyphRun.get_InkBounds() at Avalonia.Media.TextFormatting.TextLineImpl.CreateLineMetrics() at Avalonia.Media.TextFormatting.TextLineImpl.FinalizeLine() at Avalonia.Media.TextFormatting.TextFormatterImpl.FormatLine(ITextSource textSource, Int32 firstTextSourceIndex, Double paragraphWidth, TextParagraphProperties paragraphProperties, TextLineBreak previousLineBreak) at Avalonia.Media.TextFormatting.TextLayout.CreateTextLines() at Avalonia.Media.TextFormatting.TextLayout..ctor(String text, Typeface typeface, Double fontSize, IBrush foreground, TextAlignment textAlignment, TextWrapping textWrapping, TextTrimming textTrimming, TextDecorationCollection textDecorations, FlowDirection flowDirection, Double maxWidth, Double maxHeight, Double lineHeight, Double letterSpacing, Int32 maxLines, IReadOnlyList1 textStyleOverrides) at Avalonia.Controls.Presenters.TextPresenter.CreateTextLayoutInternal(Size constraint, String text, Typeface typeface, IReadOnlyList1 textStyleOverrides) at Avalonia.Controls.Presenters.TextPresenter.CreateTextLayout() at Avalonia.Controls.Presenters.TextPresenter.get_TextLayout() at Avalonia.Controls.Presenters.TextPresenter.MoveCaretToTextPosition(Int32 textPosition, Boolean trailingEdge) at Avalonia.Controls.TextBox.OnPropertyChanged(AvaloniaPropertyChangedEventArgs change) at Avalonia.AvaloniaObject.OnPropertyChangedCore(AvaloniaPropertyChangedEventArgs change) at Avalonia.Animation.Animatable.OnPropertyChangedCore(AvaloniaPropertyChangedEventArgs change) at Avalonia.AvaloniaObject.RaisePropertyChanged[T](AvaloniaProperty1 property, Optional1 oldValue, BindingValue1 newValue, BindingPriority priority, Boolean isEffectiveValue) at Avalonia.PropertyStore.EffectiveValue1.SetAndRaiseCore(ValueStore owner, StyledProperty1 property, T value, BindingPriority priority, Boolean isOverriddenCurrentValue, Boolean isCoercedDefaultValue) at Avalonia.PropertyStore.EffectiveValue1.SetCurrentValueAndRaise(ValueStore owner, StyledProperty1 property, T value) at Avalonia.PropertyStore.ValueStore.SetCurrentValue[T](StyledProperty1 property, T value) at Avalonia.AvaloniaObject.SetCurrentValue[T](StyledProperty1 property, T value) at Avalonia.Controls.TextBox.OnCaretIndexChanged(AvaloniaPropertyChangedEventArgs e) at Avalonia.Controls.TextBox.OnPropertyChanged(AvaloniaPropertyChangedEventArgs change) at Avalonia.AvaloniaObject.OnPropertyChangedCore(AvaloniaPropertyChangedEventArgs change) at Avalonia.Animation.Animatable.OnPropertyChangedCore(AvaloniaPropertyChangedEventArgs change) at Avalonia.AvaloniaObject.RaisePropertyChanged[T](AvaloniaProperty1 property, Optional1 oldValue, BindingValue1 newValue, BindingPriority priority, Boolean isEffectiveValue) at Avalonia.PropertyStore.EffectiveValue1.SetAndRaiseCore(ValueStore owner, StyledProperty1 property, T value, BindingPriority priority, Boolean isOverriddenCurrentValue, Boolean isCoercedDefaultValue) at Avalonia.PropertyStore.EffectiveValue1.SetCurrentValueAndRaise(ValueStore owner, StyledProperty1 property, T value) at Avalonia.PropertyStore.ValueStore.SetCurrentValue[T](StyledProperty1 property, T value) at Avalonia.AvaloniaObject.SetCurrentValue[T](StyledProperty1 property, T value) at Avalonia.Controls.TextBox.HandleTextInput(String input) at Avalonia.Controls.TextBox.OnTextInput(TextInputEventArgs e) at Avalonia.Input.InputElement.<>c.<.cctor>b32_4(InputElement x, TextInputEventArgs e) at Avalonia.Interactivity.RoutedEvent1.<>c__DisplayClass1_01.gAdapter|0(Object sender, RoutedEventArgs e) at Avalonia.Interactivity.RoutedEvent.<>c__DisplayClass23_0.b0(ValueTuple2 args) at Avalonia.Reactive.AnonymousObserver1.OnNext(T value) at Avalonia.Reactive.LightweightObservableBase1.PublishNext(T value) at Avalonia.Reactive.LightweightSubject1.OnNext(T value) at Avalonia.Interactivity.RoutedEvent.InvokeRaised(Object sender, RoutedEventArgs e) at Avalonia.Interactivity.EventRoute.RaiseEventImpl(RoutedEventArgs e) at Avalonia.Interactivity.EventRoute.RaiseEvent(Interactive source, RoutedEventArgs e) at Avalonia.Interactivity.Interactive.RaiseEvent(RoutedEventArgs e) at Avalonia.Input.KeyboardDevice.ProcessRawEvent(RawInputEventArgs e) at Avalonia.Input.InputManager.ProcessInput(RawInputEventArgs e) at Avalonia.Controls.TopLevel.HandleInput(RawInputEventArgs e) at Avalonia.Native.WindowBaseImpl.RawTextInputEvent(UInt64 timeStamp, String text) at Avalonia.Native.WindowBaseImpl.WindowBaseEvents.Avalonia.Native.Interop.IAvnWindowBaseEvents.RawTextInputEvent(UInt64 timeStamp, String text) at Avalonia.Native.Interop.Impl.MicroComIAvnWindowBaseEventsVTable.RawTextInputEvent(Void this, UInt64 timeStamp, Byte text) --- End of stack trace from previous location --- at Avalonia.Native.DispatcherImpl.RunLoop(CancellationToken token) at Avalonia.Threading.DispatcherFrame.Run(IControlledDispatcherImpl impl) at Avalonia.Threading.Dispatcher.PushFrame(DispatcherFrame frame) at Avalonia.Threading.Dispatcher.MainLoop(CancellationToken cancellationToken) at Avalonia.Controls.ApplicationLifetimes.ClassicDesktopStyleApplicationLifetime.Start(String[] args) at Avalonia.ClassicDesktopStyleApplicationLifetimeExtensions.StartWithClassicDesktopLifetime(AppBuilder builder, String[] args, Action`1 lifetimeBuilder) at AvaloniaApplication1.Desktop.Program.Main(String[] args) in /Users/liuzichun/Desktop/ardesktop/AvaloniaApplication1.Desktop/Program.cs:line 18

klousCan commented 2 months ago

<Setter Property="TextBox.SelectionForegroundBrush" Value="{DynamicResource TextBoxSelectionForeground}" /> 删除这一行就不报错了

rabbitism commented 2 months ago

看起来不是很合理啊

rabbitism commented 2 months ago

@pfncfen Tom can you please help to check this issue?

rabbitism commented 1 month ago

I will close this issue for now, since this is caused by the Avalonia glyph handling for ligature characters. You can check if you can use a font without ligature.