简体   繁体   English

奇怪的 WPF 字体问题

[英]Strange WPF font issue

I'm seeing a difference in text/font quality between MainMenu and ContextMenu items in my desktop app.我发现我的桌面应用程序中 MainMenu 和 ContextMenu 项目之间的文本/字体质量存在差异。 In the screenshot below, the first line was taken from a ContextMenu and the second line from a MainMenu (which arguably looks much better).在下面的屏幕截图中,第一行取自 ContextMenu,第二行取自 MainMenu(可以说看起来好多了)。 The third line is from a ContextMenu with TextOptions.TextFormattingMode="Display" applied, and while this is a slight improvement on the first it's still not as good as the MainMenu.第三行来自应用了TextOptions.TextFormattingMode="Display"的 ContextMenu,虽然这比第一行略有改进,但仍然不如 MainMenu。

在此处输入图像描述

I've used the "Snoop" tool to confirm that font styling is the same between the main menu and context menu (size, weight, family, etc.) so I'm assuming this is a rendering quality/clear type issue?我已经使用“Snoop”工具确认主菜单和上下文菜单的字体样式(大小、粗细、系列等)相同,所以我假设这是渲染质量/清晰类型问题?

The font family is "Roboto" (as I'm using the " Material Design in XAML " NuGet package), and it is a.Net6 project if that makes a difference.字体系列是“Roboto”(因为我使用的是“ Material Design in XAML ”NuGet 包),如果有所不同,它是一个 .Net6 项目。

I am pretty sure that the problem can be found here:我很确定问题可以在这里找到:

https://github.com/MaterialDesignInXAML/MaterialDesignInXamlToolkit/tree/master/MaterialDesignThemes.Wpf/Themes https://github.com/MaterialDesignInXAML/MaterialDesignInXamlToolkit/tree/master/MaterialDesignThemes.Wpf/Themes

It appears that there is a custom style for the Menu which uses that font, while there is no custom style for the ContextMenu which uses a different font.似乎使用该字体的菜单有自定义样式,而使用不同字体的上下文菜单没有自定义样式。 Probably because styling a context menu is more complex.可能是因为设置上下文菜单的样式更加复杂。

It turned out to be something to do with Remote Desktop.原来是跟Remote Desktop有关。 If I work on the PC locally then the ContextMenu text is fine but if access the PC via RDP then I see the font issue described above.如果我在本地 PC 上工作,那么 ContextMenu 文本没问题,但如果通过 RDP 访问 PC,那么我会看到上述字体问题。

A bit of a weird one, and no idea why it only affected ContextMenu fonts.有点奇怪,不知道为什么它只影响 ContextMenu fonts。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM