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...