Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Windows] Button font image source incorrectly sized on 8.0.10 when specifying a button HeightRequest #21202

Closed
MitchBomcanhao opened this issue Mar 14, 2024 · 5 comments · Fixed by #21212
Assignees
Labels
area-controls-button Button, ImageButton fixed-in-8.0.14 fixed-in-8.0.20 fixed-in-8.0.40 fixed-in-9.0.0-preview.3.10457 i/regression This issue described a confirmed regression on a currently supported version platform/windows 🪟 t/bug Something isn't working
Milestone

Comments

@MitchBomcanhao
Copy link

MitchBomcanhao commented Mar 14, 2024

Description

From version 8.0.10, using a font image source on a button image source is incorrectly resizing its content when a heightrequest is set on the button, resulting in the UI having different sized elements and the font image itself looking blurry (and increasingly blurrier depending on how small you had set the size for the font image source).

[Note: version 8.0.10 is missing from the list of versions in this bug form, which is why I had to select "other". edit: now manually changed to 8.0.10].

Steps to Reproduce

  1. add the following xaml to any page
<Button
               FontSize="18.75"
               HeightRequest="60"
               HorizontalOptions="Fill"
               Text="Button with height request set"
               TextTransform="Uppercase">
               <Button.ImageSource>
                   <FontImageSource Glyph="A" />
               </Button.ImageSource>
           </Button>
           <Button
               FontSize="18.75"
               HorizontalOptions="Fill"
               Text="Button without height request"
               TextTransform="Uppercase">
               <Button.ImageSource>
                   <FontImageSource Glyph="A" />
               </Button.ImageSource>
           </Button>
  1. Expected:
    image
  2. Observed:
    image

Link to public reproduction project repository

No response

Version with bug

8.0.10

Is this a regression from previous behavior?

Yes, this used to work in .NET MAUI

Last version that worked well

8.0.7 SR2

Affected platforms

Windows

Affected platform versions

No response

Did you find any workaround?

Using MinimumHeightRequest instead of HeightRequest stops this issue.
image

Relevant log output

No response

@MitchBomcanhao MitchBomcanhao added the t/bug Something isn't working label Mar 14, 2024
@MitchBomcanhao
Copy link
Author

when changing the font image source to include a small size, this is what it looks like
<FontImageSource Glyph="A" Size="10" />

image

top is unexpected
bottom is as expected

@PureWeen PureWeen added this to the .NET 8 SR4 milestone Mar 14, 2024
@Foda Foda added the i/regression This issue described a confirmed regression on a currently supported version label Mar 14, 2024
@MattePozzy
Copy link

MattePozzy commented Mar 15, 2024

Same issue here
with MAUI 8.0.7
image

with 8.0.10
image

The buttons have HeightRequest and the FontImageSource has Size.
Change HeightRequest to MinimunHeightRequest does not solve the issue.

  <Button
      CornerRadius="20"
      Margin="10"
      Command="{Binding ApriLoginCredenzialiCommand}"
      FontSize="{Binding LayoutSettings.ButtonFontSize}" 
      HeightRequest="{Binding LayoutSettings.ButtonHeight}" 
      Text="{lib:Translate AppMobileComuni.accediCredenziali}"
      ContentLayout="{Binding LayoutSettings.ButtonContentLayout}">
      <Button.ImageSource>
          <FontImageSource
              Size="{Binding LayoutSettings.IconFontSize}"
              FontFamily="FontIcone" 
              Glyph="{x:Static lib:MaterialFontIcons.CardAccountDetailsOutline}"/>
      </Button.ImageSource>
  </Button>

Issue found only on windows. On Android and iOS works like version 8.0.7.

@MitchBomcanhao
Copy link
Author

@MattePozzy Yes I can confirm that the workaround is not functional when using ContentLayout. In this case you don't even need to use Height request to cause it to fail.

            <Button
                ContentLayout="Top, 30"
                FontSize="30"
                Text="Button with ContentLayout='Top, 30'">
                <Button.ImageSource>
                    <FontImageSource Glyph="A" />
                </Button.ImageSource>
            </Button>

which results in this

8.0.7
image

8.0.10
image

@PureWeen
Copy link
Member

Can you test with the latest nightly build?
https://github.com/dotnet/maui/wiki/Nightly-Builds

@MitchBomcanhao
Copy link
Author

MitchBomcanhao commented Mar 20, 2024

@PureWeen it seems ok on these identified situations - but I've not done much testing around it. Used 8.0.20-nightly.10336

image

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-controls-button Button, ImageButton fixed-in-8.0.14 fixed-in-8.0.20 fixed-in-8.0.40 fixed-in-9.0.0-preview.3.10457 i/regression This issue described a confirmed regression on a currently supported version platform/windows 🪟 t/bug Something isn't working
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

6 participants