dotnet / wpf

WPF is a .NET Core UI framework for building Windows desktop applications.
MIT License
7.05k stars 1.17k forks source link

Vertical text support for TextBox/TextBlock/RichTextBox #7386

Open rampaa opened 1 year ago

rampaa commented 1 year ago

Japanese can be written from top-to-bottom, right-to-left. I would like to be able to present texts in this format in my WPF projects. Petty tricks like rotating the control won't give the desired result.

Suggestion: Add a new FlowDirection enum like "VerticalRightToLeft" that allows the aforementioned behavior.

miloush commented 1 year ago

While I would love for WPF to be at the frontier of vertical UI layout, this is a non-trivial feature request. The bit in this issue falls mostly into DWrite updates, I believe the LS currently used by WPF do actually support vertical layout, at least how it was done back then.

DWrite approach to configure this is to have separate FlowDirection and ReadingDirection properties though. For reasons I don't know, it looks like WPF's FlowDirection is actually DWrite's ReadingDirection, which is not helping.

rampaa commented 1 year ago

I believe the LS currently used by WPF do actually support vertical layout, at least how it was done back then

I don't know what LS stands for in this context (layout structure?) so I might be misinterpreting this whole sentence but let me ask this anyway: How can I try out WPF's current vertical layout support?

miloush commented 1 year ago

LS stands Line Services: https://devblogs.microsoft.com/math-in-office/lineservices/. It is a native code component involved in text layout, it powers rich text box, Word etc.

WPF does not currently support vertical text layout. My note was reflecting the fact that there are two components playing part here. DirectWrite is currently in charge of text shaping more at the character level, while Line Services are involved more at the line level - alignment, tabs etc. At the time when WPF was developed, Line Services (e.g. Word) already supported vertical text layout. However, vertical support in DirectWrite came later. I was trying to suggest that it may be the case that supporting vertical text might get away without significant changes to the Line Service part (which of course would be awesome to update to a newer version too - math anyone?)