跳至內容

微軟字體

出自 Arch Linux 中文维基

本文或本章節的語言、語法或風格需要改進。參考:幫助:風格

原因:Could be converted to use Template:App.(在Talk:微軟字體討論)

本文介紹如何安裝微軟 TrueType 字體並模擬 Windows 的渲染設置。

提示:參見 公制兼容字體 以獲取替代方案。

安裝

自動安裝

注意:這些包將在構建時自動獲取 Windows Enterprise 90 天評估版 ISO,並從中提取所需的字體。

安裝字體的最簡單方法是安裝以下包中的一個:

對於雙系統用戶,也可使用以下包:

現有軟體包

注意:這些包需要用戶預先從 Windows 分區或者 Windows 和/或 Office 2007 ISO 中手動提取字體。參閱相關的 PKGBUILD 獲取更多信息。

使用 Windows 分區中的字體

如果有一個 Windows 分區已被掛載,可以直接使用其中的字體。有以下幾種方法(假設 Windows 的 C:\ 盤被掛載在 /windows):

  • 使用符號連結:
# ln -s /windows/Windows/Fonts /usr/local/share/fonts/WindowsFonts
注意:google-chromeAUR 的用戶不應該選擇這種方法,因為連結的字體會導致 Chrome 崩潰。
  • 將字體文件複製到 /usr/local/share/fonts/
# mkdir -p /usr/local/share/fonts/WindowsFonts
# cp -r /windows/Windows/Fonts/* /usr/local/share/fonts/WindowsFonts/
# chmod -R 644 /usr/local/share/fonts/WindowsFonts/*
  • 使用綁定掛載:
# mount --bind /windows/Windows/Fonts /usr/local/share/fonts/WindowsFonts

要使其永久生效,像這樣修改 fstab 文件:

/etc/fstab
/windows/Windows/Fonts    /usr/local/share/fonts/WindowsFonts    none    bind    0    0

更多詳細信息參見 mount(8) § Bind mount operation

請注意,若不能讀取字體文件,可能需要對系統壓縮的文件採取權變措施。

在選擇以上任一方法後,重新生成字體緩存:

# fc-cache --force
# fc-cache-32 --force

從 Windows ISO 中提取字體

在 Windows ISO 文件中也可以找到字體。若 ISO 是在網絡上下載的,則包含字體的鏡像文件格式為 WIM (Windows Imaging Format);若是使用 Windows 媒體創建工具創建的,則為 ESD (Windows Electronic Software Download)。從 ISO 文件中提取 sources/install.esdsources/install.wim 文件並從中找到 Windows/Fonts 目錄。它可以用 7zwimextract (wimlib) 提取。以下是一個使用 7z 的示例:

$ 7z e WinXY_YYMM_Chinese_Simplified_x64.iso sources/install.wim
$ 7z e install.wim 1/Windows/{Fonts/"*".{ttf,ttc},System32/Licenses/neutral/"*"/"*"/license.rtf} -ofonts/

字體和許可證將放在 fonts 目錄。

舊軟體包

注意:由這些包提供的字體已過時,缺少現代微調指令和完整的字符集,但好處是不需要用戶提供字體文件。建議使用#現有軟體包所述的軟體包。

ttf-ms-fontsAUR 包含:

警告:根據原《微軟最終用戶許可協議》,使用上述字體時存在一些法律限制。

ttf-tahomaAUR 包含 Tahoma

ttf-vista-fontsAUR包括:

適用於微軟字體的 Fontconfig 規則

相似字體的映射規則

網站通常使用字體的通用名稱 (helvetica, courier, times 或 times new roman),Fontconfig 的一個規則文件 /etc/fonts/conf.d/30-metric-aliases.conf 將其替換為免費字體(Liberation、Google CrOS、GUST TeX Gyre……)。

要使用微軟字體,需要將上述通用名稱映射到微軟的字體:

 <?xml version="1.0"?>
 <!DOCTYPE fontconfig SYSTEM "fonts.dtd">
 <fontconfig>
 <!-- Map generics to MS specifics -->
        <!-- PostScript -->
        <alias binding="same">
          <family>Helvetica</family>
          <accept>
          <family>Arial</family>
          </accept>
        </alias>
        <alias binding="same">
          <family>Times</family>
          <accept>
          <family>Times New Roman</family>
          </accept>
        </alias>
        <alias binding="same">
          <family>Courier</family>
          <accept>
          <family>Courier New</family>
          </accept>
        </alias>
 </fontconfig>

建議在瀏覽器中,將 serif、sans-serif 和 monospace 字體也映射到微軟字體。

禁用字體內嵌位圖

一些微軟的 TTF 字體,如 Calibri 和 Cambria,包含了特定大小的內嵌位圖字體,這些字體不支持抗鋸齒。如果啟用了字體內嵌位圖,在這些特定的尺寸下,字體不會被進行抗鋸齒處理。通過字體配置可以禁用內嵌位圖字體

已知問題

基於 Poppler 的 PDF 閱讀器無法正確顯示符號

微軟的 TrueType 符號字體(Symbol)在 Poppler 上有問題,數學符號可能無法在基於 Poppler 的 PDF 閱讀器中正確顯示。