dotnet / maui

.NET MAUI is the .NET Multi-platform App UI, a framework for building native device applications spanning mobile, tablet, and desktop.
https://dot.net/maui
MIT License
22.06k stars 1.73k forks source link

The font size of a label with formattedtext is not the same as the fontsize of a label with regular text #18098

Open sjorsmiltenburg opened 12 months ago

sjorsmiltenburg commented 12 months ago

Description

Occurs on Windows, not yet tested other platforms image

<Label Margin="20,0,20,0" Text="This is a sample text" TextColor="LightGray" FontSize="Large"/>
<Label Margin="20,0,20,0" TextColor="LightGray" >
    <Label.FormattedText>
        <FormattedString>
            <Span Text="This " FontSize="Large"></Span>
            <Span Text="is"  TextDecorations="Underline" FontSize="Large"/>
            <Span Text=" a sample text" FontSize="Large"/>
        </FormattedString>
    </Label.FormattedText>
</Label>

Steps to Reproduce

open sample project - press bug9 button

Link to public reproduction project repository

https://github.com/sjorsmiltenburg/maui_bugs.git

Version with bug

8.0.0-rc.2.9373

Is this a regression from previous behavior?

Not sure, did not test other versions

Last version that worked well

Unknown/Other

Affected platforms

Windows

Affected platform versions

Windows

Did you find any workaround?

no

Relevant log output

No response

SmartmanApps commented 12 months ago

Yes! I have just recently run into this, having just used formatted text for the first time. Thought that was odd.

I also want to add (haven't created an issue yet because I haven't created a repro repo yet) that on Windows (not on Android - works on Android) trailing space is being ignored in the label's text. So, quick little fix to make the background a bit bigger, add a space either side of the text, but on Windows the trailing space gets ignored. That's even with regular text, not just formatted text.

ghost commented 12 months ago

We've added this issue to our backlog, and we will work to address it as time and resources allow. If you have any additional information or questions about this issue, please leave a comment. For additional info about issue management, please read our Triage Process.

XamlTest commented 12 months ago

Verified this on Visual Studio Enterprise 17.8.0 Preview 4.0(8.0.0-rc.2.9373). Repro on Windows 11, Android 13.0-API33 and iOS 16.4 with below Project: maui_bugs.zip