使用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