Windows XP Windows 7 Windows 2003 Windows Vista Windows 綜合教學 Linux 系統教學
Windows 10 Windows 8 Windows 2008 Windows NT Windows Server 電腦軟體教學
您现在的位置: Windows教程網 >> Windows教程 >  >> Linux 系統教學 >> 關於 Linux

解決 Linux Firefox 中文亂碼:禁止網頁自選字體、移除/修改 49-sansserif.conf Fontconfig 規則、指定首選字體

編輯:關於 Linux

Firefox 預設允許網頁指定字體,導致 Linux 上中文回退字體錯誤顯示亂碼。本文提供三層解決方案:GUI 設定禁止網頁自選字體、暴力移除 /etc/fonts/conf.d/49-sansserif.conf、精準修改 Fontconfig 規則指定首選中文字體 (如思源黑體、Noto Sans CJK)。

Firefox 字體設定

方案一:GUI 禁止網頁自選字體 (最簡單)

  1. 選單 → 設定 → 一般 → 語言與外觀 → 字體 → 進階。
  2. 取消勾選「允許網頁選擇使用的字體,而非上方設定」。
  3. 重啟 Firefox。

方案二:暴力移除衝突規則 (快速見效)


sudo mv /etc/fonts/conf.d/49-sansserif.conf /etc/fonts/conf.d/49-sansserif.conf.bak
fc-cache -fv

49-sansserif.conf 原為 Flash Player 字體回退規則,現多與系統中文字體衝突。

方案三:精準修改 Fontconfig 指定首選字體 (推薦)


# 編輯或建立 /etc/fonts/conf.d/99-my-fonts.conf



  
    sans-serif
    serif
    monospace
    Noto Sans CJK TC
  


fc-cache -fv
  • mode="append_last":在字體回退列表末尾添加,保留原有優先序。
  • 將 Noto Sans CJK TC 替換為你偏好的字體 (如 Source Han Sans TC、PingFang TC)。

驗證方式


fc-match sans-serif
# 應顯示你指定的字體檔案路徑

套用方案三後,Firefox 及所有 GTK/Qt 應用程式中文顯示將統一、清晰、無亂碼。

Copyright © Windows教程網 All Rights Reserved