使用Opentype功能冰櫃,您可以將某些Opentype功能“凍結”到字體中。
然後“默認情況下”這些功能,因此即使在不支持libreoffice,openoffice,openoffice或不支持Microsoft Office等特定功能的應用程序中,在不支持OpenType功能的應用程序中,即使在不支持OpenType功能的應用中,也可以訪問以前可以通過Opentype功能(例如SmallCaps,OldStyle Numerals或本地化表單)訪問的字符。
注意:此工具實際上通過應用指定的GSUB功能來重新刪除字體的cmap表。它不能用於替換,沒有字形都有任何cmap條目。僅支持單個和替代替代。
該工具有兩個版本: OtFeatureFreezer :用於MacOS和Windows的簡單GUI(圖形)應用程序,您可以下載和運行,而無需任何特殊的驗證,而PyftFeatFeatFreeze :CLI(命令行)應用程序,該應用程序需要Python 3.6或更新才能安裝在計算機上。
當前版本: 1.32
此工具要求首先安裝Python 3.6或更高版本。從https://www.python.org或您的軟件包管理器獲取它。
我們建議使用PIPX安裝Python命令行工具。 PIPX將它們整齊地在計算機上刪除,並為您提供一種在所有平台上添加,更新和刪除Python工具的簡便方法,而無需在Python安裝中留下混亂。
pipx install opentype-feature-freezer
pip其與任何其他Python軟件包一樣安裝。
# This is best done inside a virtual environment, so you don't pollute
# your Python installation and need no special privileges to install anything.
pip install --upgrade opentype-feature-freezer
如果這不起作用,請嘗試:
python3 -m pip install --user --upgrade opentype-feature-freezer
pip install --upgrade git+https://github.com/twardoch/fonttools-opentype-feature-freezer
如果這不起作用,請使用:
python3 -m pip install --user --upgrade git+https://github.com/twardoch/fonttools-opentype-feature-freezer
pip install --upgrade configparser假設您具有字體Charsissil-r.ttf (菜單名稱為“ charis sil”),並且該字體包含可通過Opentype佈局特徵c2sc (用於大寫)和smcp (用於小寫)的True SmallCaps。假設您想製作第二個字體,默認情況下可用的是真正的小蓋。只是運行:
pyftfeatfreeze -f 'c2sc,smcp' -S -U SC -R 'Charis SIL/Charix,CharisSIL/Charix' CharisSIL-R.ttf CharixSC-R.ttf
您將獲得一個新的字體Charsissil-r.ttf (菜單名稱“ Charix SC”)。該字體將具有小蓋,而不是所有應用程序中都可以使用的小寫字母和大寫字母。
由於“ charis sil”字體是在OFL下許可的,並使用了保留字體名稱“ charis”和“ sil”,因此我指定了-R選項以替換名稱字符串Charis SIL和CharisSIL用Charix 。這樣,修改的字體符合OFL,我可以分發它。
以下示例重新刪除字體,以便默認情況下所有應用程序中都可以使用保加利亞的本地化表單(後綴“ bg”將添加到菜單名稱中):
pyftfeatfreeze -f 'locl' -s 'cyrl' -l 'BGR ' -S -U BG SomeFont.ttf SomeFontBG.ttf
注意:要重建多個腳本或語言系統的功能,請多次運行工具(以上一個運行的輸出為輸入)。僅在最終運行中使用-S選項。
以下在所有內部字體名稱中(在name和CFF表中)中替換了Otal Lato ,而無需進行任何“功能凍結”。這可以用來快速更改一些內部字體名稱:
pyftfeatfreeze -R 'Lato/Otal' Lato-Regular.ttf Otal-Regular.ttf
usage: pyftfeatfreeze [-h] [-f FEATURES] [-s SCRIPT] [-l LANG] [-z] [-S]
[-U USESUFFIX] [-R REPLACENAMES] [-i] [-r] [-n] [-v]
[-V]
inpath [outpath]
With pyftfeatfreeze you can "freeze" some OpenType features into a font. These
features are then "on by default", even in apps that don't support OpenType
features. Internally, the tool remaps the "cmap" table of the font by applying
the specified GSUB features. Only single and alternate substitutions are
supported.
positional arguments:
inpath input .otf or .ttf font file
outpath output .otf or .ttf font file (optional)
optional arguments:
-h, --help show this help message and exit
options to control feature freezing:
-f FEATURES, --features FEATURES
comma-separated list of OpenType feature tags, e.g.
'smcp,c2sc,onum'
-s SCRIPT, --script SCRIPT
OpenType script tag, e.g. 'cyrl' (default: 'latn')
-l LANG, --lang LANG OpenType language tag, e.g. 'SRB ' (optional)
-z, --zapnames zap glyphnames from the font ('post' table version 3,
.ttf only)
options to control font renaming:
-S, --suffix add a suffix to the font family name (by default, the
suffix will be constructed from the OpenType feature
tags)
-U USESUFFIX, --usesuffix USESUFFIX
use a custom suffix when --suffix is provided
-R REPLACENAMES, --replacenames REPLACENAMES
search for strings in the font naming tables and
replace them, format is
'search1/replace1,search2/replace2,...'
-i, --info update font version string
reporting options:
-r, --report report languages, scripts and features in font
-n, --names output names of remapped glyphs during processing
-v, --verbose print additional information during processing
-V, --version show program's version number and exit
Examples: pyftfeatfreeze -f 'c2sc,smcp' -S -U SC OpenSans.ttf OpenSansSC.ttf
pyftfeatfreeze -R 'Lato/Otal' Lato-Regular.ttf Otal-Regular.ttf
提示: -n選項輸出“冷凍”字形的空間分隔列表。如果將其重定向到文件,則可以將此列表用作pyftsubset的輸入來創建僅包含“冷凍”字形的小字體。
要報告問題,請打開問題。您需要一個github帳戶。
此工具在Apache許可證(版本2.0)下被許可“原樣”。通過使用該工具,您可以接受許可證的所有條件,包括保修和責任限制。如果使用此工具,請諮詢您的字體EULA是否允許修改。如果字體是在OFL下許可並使用保留字體名稱的許可,請使用-R選項將“保留字體名稱”更改為其他內容。
該工具為Python 3.6+編寫,並使用Fonttools/ttx。
-s (腳本)選項,以便如果未提供,則在所有腳本中進行重新映射。-S (後綴)選項,以便如果未提供,則不會添加sufix,並添加了GUI應用程序。fonttools-utils Repo的其他工具現在位於Fonttools-TTXJSON和MAC-OS-X-SYSTEM-FONT-REPLACER要構建Python軟件包,請安裝詩歌:
pip install poetry
或者
python3 -m install --user --upgrade poetry
然後在項目運行的主要文件夾中:
poetry build
要構建DMG&EXE,您需要MacOS。在應用程序子文件夾中,運行./macdeploy all