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

Font style does not work in Application.SetDefaultFont() when the text scale value is bigger than 100% in OS #4978

Closed
John-Qiao opened this issue May 26, 2021 · 6 comments · Fixed by #5030
Labels
🪲 bug Product bug (most likely)

Comments

@John-Qiao
Copy link
Member

  • .NET Core Version:

    .NET SDK 6.0.100-preview.5.21275.4

  • Have you experienced this same bug with .NET Framework?:

    No

More Info:

This issue occurs in other System.Drawing.FontStyle enum values too, like Bold, Strikeout and Underline...

Problem description:

The font style is not Italic for controls in form.
Actual
ReproSteps

Expected behavior:

The font style should be Italic in form, like it works when text scale is 100%.
Expected

Minimal repro:

  1. Open the attached TestApp.zip project in VS, run it and check the font style of buttons. -- Font style is Italic in this time.
  2. Stop the project, and open the Display setting in OS, then change the text scale(Make text bigger) to 150% and click Apply option.
  3. Run project again and observe the font style in controls.
@Olina-Zhang
Copy link
Member

This issue was found after the PR: #4911 merged.

@kirsan31
Copy link
Contributor

kirsan31 commented May 26, 2021

The problem is here:

s_defaultFontScaled = new Font(s_defaultFont.FontFamily, s_defaultFont.Size * textScaleValue);

We need to set FontStyle too:

s_defaultFontScaled = new Font(s_defaultFont.FontFamily, s_defaultFont.Size * textScaleValue, s_defaultFont.Style);

Miss it too during review :(

@dreddy-work dreddy-work added the help wanted Good issue for external contributors label May 26, 2021
@dreddy-work dreddy-work added this to the 6.0 Preview6 milestone May 26, 2021
@RussKie
Copy link
Member

RussKie commented May 26, 2021

🤦‍♂️

@ghost ghost added the 🚧 work in progress Work that is current in progress label Jun 2, 2021
RussKie added a commit to RussKie/winforms that referenced this issue Jun 2, 2021
@ghost ghost removed this from the 6.0 Preview6 milestone Jun 3, 2021
@ghost ghost removed the 🚧 work in progress Work that is current in progress label Jun 3, 2021
@RussKie RussKie added 🪲 bug Product bug (most likely) and removed help wanted Good issue for external contributors labels Jun 3, 2021
@dotnet dotnet deleted a comment from kirsan31 Jun 16, 2021
@John-Qiao
Copy link
Member Author

Verified with .NET 6.0.100-preview.6.21315.23 + private binaries build from main branch in dotnet/winforms repo, this issue has been fixed that font style works when the text scale value is bigger than 100% in OS.
TestResult

@John-Qiao
Copy link
Member Author

Verified with .NET 6.0.100-preview.7.21320.2 from main branch, this issue has been fixed that font style works as above when the text scale value is bigger than 100% in OS.

@John-Qiao
Copy link
Member Author

Verified the issue with .NET 6.0 6.0.100-preview.6.21323.1, it is fixed as above result too.

@ghost ghost locked as resolved and limited conversation to collaborators Jan 28, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
🪲 bug Product bug (most likely)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants