Skip to content

FontNameEditor rendering artifact - *just* the blue box #1106

@RussKie

Description

@RussKie

Problem description:

FontNameEditor font preview is showing less characters.
For example on the below screenshots:

Font .NET 4.7.2 .NET Core 3.0
Arial Black ab a
Forte abc ab
Lucida Handwriting ab a

Actual behavior:

.NET 4.7.2 .NET Core 3.0
image image

🤔 ink It is possible the change may related to the change of the default font in #656.

Expected behavior:

We show the same amount of characters as with .NET FX.

It looks like we can achieve the same render by reducing the fontSize in DrawFontSample:

        private static void DrawFontSample(PaintValueEventArgs e, FontFamily fontFamily, FontStyle fontStyle)
        {
            float fontSize = (float)(e.Bounds.Height / 1.2);
            using (var font = new Font(fontFamily, fontSize, fontStyle, GraphicsUnit.Pixel))
            {
                e.Graphics.DrawString("abcd", font, SystemBrushes.ActiveCaptionText, e.Bounds);
            }
        }

Minimal repro:

  • Run WinformsControlsTest in .NET 4.7.2 and .NET 3
  • Compare

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions