如何修复Void Linux+i3窗口管理器下的字体渲染模糊问题
Void Linux + i3 字体像素化、渲染不流畅问题
近期安装了基础版Void Linux及i3窗口管理器,发现系统内所有含文本的程序(Firefox、文件管理器、终端等)字体均严重像素化、显示不流畅。
查阅Void官方文档后,文档提及的命令未能解决问题,字体仍无法平滑渲染。字体显示效果如图所示:
知道需要编辑字体配置文件,但不清楚具体操作,担心误改导致系统故障。
以下是fc-conflist命令的输出:
+ /etc/fonts/conf.d/10-hinting-slight.conf: Set hintslight to hintstyle + /etc/fonts/conf.d/10-scale-bitmap-fonts.conf: Bitmap scaling + /etc/fonts/conf.d/11-lcdfilter-default.conf: Use lcddefault as default for LCD filter + /etc/fonts/conf.d/20-unhint-small-dejavu-sans-mono.conf: No description + /etc/fonts/conf.d/20-unhint-small-dejavu-sans.conf: No description + /etc/fonts/conf.d/20-unhint-small-dejavu-serif.conf: No description + /etc/fonts/conf.d/20-unhint-small-vera.conf: Disable hinting for Bitstream Vera fonts when the size is less than 8ppem + /etc/fonts/conf.d/30-metric-aliases.conf: Set substitutions for similar/metric-compatible families + /etc/fonts/conf.d/40-nonlatin.conf: Set substitutions for non-Latin fonts + /etc/fonts/conf.d/42-luxi-mono.conf: No description + /etc/fonts/conf.d/45-generic.conf: Set substitutions for emoji/math fonts + /etc/fonts/conf.d/45-latin.conf: Set substitutions for Latin fonts + /etc/fonts/conf.d/48-spacing.conf: Add mono to the family when spacing is 100 + /etc/fonts/conf.d/49-sansserif.conf: Add sans-serif to the family when no generic name + /home/pavel/.config/fontconfig/conf.d/19-DefaultProperties.conf: No description + /home/pavel/.config/fontconfig/conf.d/19-DisplayProperties.conf: No description + /home/pavel/.config/fontconfig/conf.d/39-Aliases.conf: No description + /home/pavel/.config/fontconfig/conf.d/78-Reject.conf: No description + /home/pavel/.config/fontconfig/fonts.conf: No description + /etc/fonts/conf.d/50-user.conf: Load per-user customization files + /etc/fonts/conf.d/51-local.conf: Load local customization file + /etc/fonts/conf.d/57-dejavu-sans-mono.conf: No description + /etc/fonts/conf.d/57-dejavu-sans.conf: No description + /etc/fonts/conf.d/57-dejavu-serif.conf: No description + /etc/fonts/conf.d/60-generic.conf: Set preferable fonts for emoji/math fonts + /etc/fonts/conf.d/60-latin.conf: Set preferable fonts for Latin + /etc/fonts/conf.d/65-fonts-persian.conf: No description + /etc/fonts/conf.d/65-nonlatin.conf: Set preferable fonts for non-Latin + /etc/fonts/conf.d/69-unifont.conf: No description + /etc/fonts/conf.d/80-delicious.conf: No description + /etc/fonts/conf.d/90-synthetic.conf: No description + /etc/fonts/fonts.conf: Default configuration file - /usr/share/fontconfig/conf.avail/05-reset-dirs-sample.conf: Re-define fonts dirs sample - /usr/share/fontconfig/conf.avail/09-autohint-if-no-hinting.conf: Enable autohinter if font doesn't have any hinting - /usr/share/fontconfig/conf.avail/10-autohint.conf: Enable autohinter - /usr/share/fontconfig/conf.avail/10-hinting-full.conf: Set hintfull to hintstyle - /usr/share/fontconfig/conf.avail/10-hinting-medium.conf: Set hintmedium to hintstyle - /usr/share/fontconfig/conf.avail/10-hinting-none.conf: Set hintnone to hintstyle - /usr/share/fontconfig/conf.avail/10-no-sub-pixel.conf: Disable sub-pixel rendering - /usr/share/fontconfig/conf.avail/10-sub-pixel-bgr.conf: Enable sub-pixel rendering with the BGR stripes layout - /usr/share/fontconfig/conf.avail/10-sub-pixel-rgb.conf: Enable sub-pixel rendering with the RGB stripes layout - /usr/share/fontconfig/conf.avail/10-sub-pixel-vbgr.conf: Enable sub-pixel rendering with the vertical BGR stripes layout - /usr/share/fontconfig/conf.avail/10-sub-pixel-vrgb.conf: Enable sub-pixel rendering with the vertical RGB stripes layout - /usr/share/fontconfig/conf.avail/10-unhinted.conf: Disable hinting - /usr/share/fontconfig/conf.avail/11-lcdfilter-legacy.conf: Use lcdlegacy as default for LCD filter - /usr/share/fontconfig/conf.avail/11-lcdfilter-light.conf: Use lcdlight as default for LCD filter - /usr/share/fontconfig/conf.avail/25-unhint-nonlatin.conf: Disable hinting for CJK fonts - /usr/share/fontconfig/conf.avail/35-lang-normalize.conf: No description - /usr/share/fontconfig/conf.avail/65-khmer.conf: No description
解决步骤
1. 启用子像素渲染与自动 hinter
从fc-conflist输出可知,当前未启用子像素渲染和自动 hinter,这是字体像素化的核心原因。执行以下命令(根据屏幕子像素布局选择对应项,多数LCD屏幕为RGB):
# 启用自动hinter sudo ln -s /usr/share/fontconfig/conf.avail/10-autohint.conf /etc/fonts/conf.d/ # 启用RGB子像素渲染(BGR屏幕替换为10-sub-pixel-bgr.conf) sudo ln -s /usr/share/fontconfig/conf.avail/10-sub-pixel-rgb.conf /etc/fonts/conf.d/ # 切换至更柔和的LCD滤镜 sudo ln -sf /usr/share/fontconfig/conf.avail/11-lcdfilter-light.conf /etc/fonts/conf.d/11-lcdfilter-default.conf
2. 配置用户级字体渲染(更安全,不影响系统全局)
若不想修改系统配置,可在用户目录创建自定义配置文件~/.config/fontconfig/conf.d/20-custom-font-rendering.conf,内容如下:
<?xml version="1.0"?> <!DOCTYPE fontconfig SYSTEM "urn:fontconfig:fonts.dtd"> <fontconfig> <!-- 启用自动hinter --> <match target="font"> <edit mode="assign" name="autohint"> <bool>true</bool> </edit> </match> <!-- 设置RGB子像素渲染 --> <match target="font"> <edit mode="assign" name="rgba"> <const>rgb</const> </edit> </match> <!-- 启用柔和LCD滤镜 --> <match target="font"> <edit mode="assign" name="lcdfilter"> <const>lcdlight</const> </edit> </match> <!-- 设置轻微hinting --> <match target="font"> <edit mode="assign" name="hintstyle"> <const>hintslight</const> </edit> </match> </fontconfig>
3. 更新字体缓存并重启程序
执行命令刷新字体缓存:
fc-cache -fv
随后重启所有有字体问题的程序,或按Mod+Shift+R重启i3会话。
4. 可选:补充优质字体包
Void基础版可能缺少常用字体,安装以下包完善字体库:
sudo xbps-install -S noto-fonts noto-fonts-ttf noto-fonts-emoji
内容的提问来源于stack exchange,提问作者Comet_Z
相关产品推荐
相关产品推荐

