View Issue Details

IDProjectCategoryView StatusLast Update
0003113NoesisGUIC# SDKpublic2024-02-23 10:03
ReporterDemond Assigned Tojsantos  
PrioritynormalSeverityfeature 
Status assignedResolutionopen 
Product Version3.2 
Summary0003113: TextBlock Vertical Trim. Text Extensions
Description

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=BYRgBA3gUGYEYEMDGBrA5gJwPYFcB2AJgLRJYA2WGAXGBgKYEDcMYALnQB6tFxYdGsMASwC2NXq2DNY7Ljz5EGaOjSQIADmARl1wBHDqshSZgF8APAHpLAPnOgbAFU6teHMI%20EirDoA

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.

Attached Files
Test TextVerticalTrim.png (82,965 bytes)   
Test TextVerticalTrim.png (82,965 bytes)   
PlatformAny

Activities

Issue History

Date Modified Username Field Change
2024-02-21 20:20 Demond New Issue
2024-02-21 20:20 Demond File Added: Test TextVerticalTrim.png
2024-02-21 21:12 Demond Description Updated
2024-02-23 10:03 jsantos Assigned To => jsantos
2024-02-23 10:03 jsantos Status new => assigned