Fontconfig

本頁使用了標題或全文手工轉換
維基百科,自由的百科全書
Fontconfig
開發者基思·帕卡德
目前版本
  • 2.13.96 (2022年2月4日;不穩定版)[1]
  • 2.15.0 (2023年12月22日;穩定版本)[2]
編輯維基數據連結
原始碼庫 編輯維基數據連結
作業系統Unix-like 系統
類型字型處理庫
特許條款MIT特許條款
網站www.freedesktop.org/wiki/Software/fontconfig/

Fontconfig是一種與字體相關的電腦程式庫,用於組態、客製化全系統的字型,或將字體提供給應用程式使用。此庫最初是由基思·帕卡德(Keith Packard)開發維護的,現由貝赫達德·埃斯法赫博德(Behdad Esfahbod)維護。Fontconfig是自由軟件,採用寬鬆開放著作權特許條款[3]

用法[編輯]

應用程式可以通過兩種方式從fontconfig獲得字體:

  1. 查詢
  2. 模式匹配。 Fontconfig 將返回和指定模式最匹配的字型。

為了進行字型匹配,fontconfig 儲存所有已經安裝字型的大量排版資訊,例如字型名稱、風格、大小、DPIUnicode覆蓋範圍等。這些資訊也被用來執行字型替換。

檔案[編輯]

Fontconfig使用XML格式的設定檔。 Fontconfig的DTD檔案通常位於/etc/fonts/fonts.dtd

主設定檔是/etc/fonts/fonts.conf,參照少量的其他設定檔(有可能不存在):

  • /etc/fonts/local.conf
  • /etc/fonts/conf.d directory
  • ~/.fonts.conf

一個簡單的設定檔例子:

 <?xml version="1.0"?>
 <!DOCTYPE fontconfig SYSTEM "fonts.dtd">
 <fontconfig>
   <!-- Enable antialiasing for all fonts -->
   <match target="font">
     <edit mode="assign" name="antialias"><bool>true</bool></edit>
   </match>
 </fontconfig>

更多細節,請參見fontconfig manual頁面存檔備份,存於互聯網檔案館) 。

工具包[編輯]

fontconfig提供了8個命令列工具來管理字型組態:

  • fc-list:列出fontconfig知道的所有和模式匹配的字型。
  • fc-match:匹配字型模式(預設為空模式),使用正常的fontconfig匹配規則來尋找最合適的字型。
  • fc-cache:建立一個所有FreeType於指定目錄(或者設定檔中指定的所有目錄)中可讀字型的快取
  • fc-cat:從快取檔案或者相關字型目錄中讀取字型資訊,並且以ASCII格式輸出。
  • fc-query:查詢字型檔案並報告產生的模式。
  • fc-scan:掃描字型檔案和目錄並報告產生的模式。
  • fc-pattern:列舉匹配提供模式的最佳字型。
  • fc-validate:驗證字型檔案並報告結果。

Fontconfig建立在FreeType(一個字型彩現器)和expat(一個XML解析庫)之上,這兩個都是自由軟件

Fontmatrix 是一個有圖形用戶介面的互動工具,可以使用fontconfig列出可用的字型以及顯示資訊。

版本號說明[編輯]

當fontconfig接近發佈時,最末位版本號用大於等於90的數字表示。

外部連結[編輯]

參見[編輯]

參照[編輯]

  1. ^ Release 2.13.96. 
  2. ^ 2.15.0 · Tags · fontconfig. 
  3. ^ fontconfig-2.6.0.tar.gz (see file "COPYING"). freedesktop.org. [2020-07-16]. (原始內容存檔於2010-11-23). Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Keith Packard not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission...