Demond
Topic Author
Posts: 11
Joined: 06 Feb 2023, 23:32

[Enhancement] Text Extensions. TextBlock Vertical Trim

21 Feb 2024, 11:55

Hello! While working with the layout, I came across this thing. I have a small header with text. I want to set the height of the Border to be based on the height of the largest glyph. In my case the text has the number 24. The default text height includes vertical padding. I'd like to get rid of these indentations using a new text property. I see that you already have your own Noesis extension for various elements, including text.

I propose adding a new TextTrimVertical property that would allow for more precise text positioning and alignment. I haven't found a similar property and implementation in WPF. There is a similar property in CSS, but browsers do not currently support it.

https://caniuse.com/css-text-box-trim

An example of how a property works in CSS: https://text-box-trim.vercel.app/?c=BYR ... HMI+EirDoA

I drew a layout in Figma similar to the layout implementation in xaml, which displays the layout behavior with and without vertical text indentation (Figma has a VerticalTrim text property to remove vertical text indentation)

In the figure you can see that with the VerticalTrim property it was possible to align the number of living players and the text “Players Alive” along one line.

Of course you can use a negative Padding value for a TextBlock , but it doesn't have the same effect as VerticalTrim because the number glyphs may not be perfectly centered. In the example I'm using the Verdana font.
Attachments
Test TextVerticalTrim.png
 
User avatar
jsantos
Site Admin
Posts: 3938
Joined: 20 Jan 2012, 17:18
Contact:

Re: [Enhancement] Text Extensions. TextBlock Vertical Trim

21 Feb 2024, 19:12

This is a very interesting feature. Could you please create a ticket for this?

As you said, you can achieve something similar playing with the Margin property.

 
Demond
Topic Author
Posts: 11
Joined: 06 Feb 2023, 23:32

Re: [Enhancement] Text Extensions. TextBlock Vertical Trim

21 Feb 2024, 20:23

This is a very interesting feature. Could you please create a ticket for this?

As you said, you can achieve something similar playing with the Margin property.

Thanks for your feedback! I created a ticket, here is the link: https://www.noesisengine.com/bugs/view.php?id=3113

Who is online

Users browsing this forum: Ahrefs [Bot], Semrush [Bot] and 3 guests