2dust / v2rayN

A GUI client for Windows, support Xray core and v2fly core and others
https://1.2345345.xyz
GNU General Public License v3.0
67.21k stars 11.21k forks source link

[Feature request]: 建议xaml文件增加TextOptions.TextHintingMode="Fixed",禁用字体的hinting,使得低分屏的中文字体渲染更平滑 #5713

Open Scott0902 opened 5 hours ago

Scott0902 commented 5 hours ago

相关问题

默认的微软雅黑字体在低分屏下总会使用臭名昭著的hinting显示,导致中文字体高低不平,只有在系统缩放比例在200%或以上,字体才不使用hinting。但并非所有人都有高分屏,我的系统缩放比例是125%,而且已通过TtfAutoHint工具去掉微软雅黑字体的所有hinting,使得大部分情况下微软雅黑字体都渲染得很平滑。由于v2rayN采用WPF字体渲染机制,即使我去掉微软雅黑的hinting,当前的v2rayN仍强制使用hinting算法渲染字体,字体显得怪异。

描述你希望的解决方案

我建议修改源代码的xaml文件,修改TextOptions,增加一行TextOptions.TextHintingMode="Fixed",还要把TextOptions.TextFormattingMode的值由"Display"改为"Ideal",以及 TextOptions.TextRenderingMode的值由"Auto改为"ClearType"

描述你所考虑的替代方案

No response

我确认已查询历史issues

Scott0902 commented 5 hours ago

我的系统是Windows 10,显示器分辨率1920*1200,系统的缩放比例是125%,v2rayN的字体大小设为14。 为详细说明我的问题,我附上图片说明。 首先默认的微软雅黑字体带hinting(这是长期诟病的字体高低不平现象): v2ray msyh hinted

然后经过TtfAutoHint工具去掉微软雅黑的hinting后,v2rayN显示的微软雅黑虽然没有高低不平,但线条的粗细不一: v2ray msyh removed hinting

最后我修改源代码的xaml文件,需要修改的xaml文件包括: AddServer2Window.xaml AddServerWindow.xaml DNSSettingWindow.xaml GlobalHotkeySettingWindow.xaml MainWindow.xaml OptionSettingWindow.xaml RoutingRuleDetailsWindow.xaml RoutingRuleSettingWindow.xaml RoutingSettingWindow.xaml SubEditWindow.xaml SubSettingWindow.xaml

把以上xaml文件的下面两行:

TextOptions.TextFormattingMode="Display"
TextOptions.TextRenderingMode="Auto"

改为下面三行:

TextOptions.TextFormattingMode="Ideal"
TextOptions.TextRenderingMode="ClearType"
TextOptions.TextHintingMode="Fixed"

运行build.ps1编译后,v2RayN显示的微软雅黑变得很圆滑,媲美macType渲染的效果: v2ray recompile msyh removed hinting