FONTPM是类似软件包的命令行实用程序,可让您迅速安装字体,类似于您允许您安装软件包的包装管理器。
笔记
FONTPM在其功能集中非常基本。如果您想查看添加的功能,请打开问题。
目前,它仅支持从Google字体下载非变量字体。如果您发现您认为FONTPM应该有的其他来源,请在存储库中打开一个问题!
FONTPM只需通过运行cargo install fontpm即可通过货物安装。这是建议做事的推荐方法。
也可以通过从源构建它来安装FONTPM。目前,没有一个稳定的分支,因此您只需要弄清楚要从哪个提交的订单即可。对开发分支的稳定性没有保证。
第一步是使用git克隆存储库: git clone https://github.com/tecc/fontpm.git 。完成此操作后,您可以通过运行cargo install --path <path-to-fontpm>/cli (其中<to to to to to <path-to-fontpm> >是关闭的目录fontpm。
一个用于构建和从源安装的完整脚本看起来像这样:
git clone https://github.com/tecc/fontpm.git
cd fontpm
cargo install --path ./cli 使用FONTPM之前,您需要做的第一件事是刷新本地字体索引。您可以使用fontpm refresh执行此操作。
FONTPM下载每个源的可用字体索引,但它不会自动为您完成。刷新
fontpm refresh警告
全球安装字体可能无法在所有平台上使用。它应该与任何符合XDG基本目录的Linux系统一起使用,但除此之外,它未经测试。
要将字体安装到计算机上,只需运行以下命令:
fontpm install < font-id... >用您要安装的任何字体替换<font-id> 。这通常是在kebab-case中,因此,如果要安装Noto Sans,则会写noto-sans 。
要安装多个字体,只需列出由空格隔开的字体ID即可。
将字体安装到特定目录类似于在全球安装它们。只需运行以下命令,将<font-id>替换为要使用的任何字体,而<directory>为要安装字体的任何目录
fontpm install -d < directory > < font-id... >此外,您可以使用-f (或--format )标志来指定您希望FONTPM组织文件的方式。到目前为止,它仅支持2种模式 - flat和flat-directory 。
fontpm install -d < directory > -f < format > < font-id... >如果您使用flat ,则文件看起来有点像这样:
<directory>
|_ font1-italic.ttf
|_ font1-regular.ttf
|_ font2-italic.ttf
|_ font2-regular.ttf
flat-directory将它们分为基于字体ID的目录,这意味着它有点像这样:
<directory>
|_ font1
| |_ italic.ttf
| |_ regular.ttf
|_ font2
| |_ italic.ttf
| |_ regular.ttf
警告
此命令能够不可撤销地删除所有FONTPM文件。确保您在做什么。
在某些情况下,您可能会决定要清除FONTPM创建的文件(也许是为了节省设备上的存储空间)。可以使用purge命令完成此操作:
fontpm purge < target > target参数指定您要删除的内容。目前,它允许三个值: cache (针对FONTPM使用的缓存文件), fonts (或installed-fonts ,针对所有已安装字体)和all (针对两个以前的目标)。
fontpm的配置( config.toml )位于平台特定目录中:
$XDG_CONFIG_HOME/fontpm为单位(通常为(如果未设置$XDG_CONFIG_HOME $HOME/.config/fontpm为默认/home/alice/.config/fontpm )C:UsersAliceAppDataRoaming )。$HOME/Library/Application Support (示例: /Users/Alice/Library/Application Support )。[ fontpm ] # The main section of the configuration
# enabled_sources: array<string>
# A list of source IDs.
# All the sources included in this array, FontPM will use at runtime.
enabled_sources = [ " google-fonts " ]
# cache_dir: path
# Path to the directory where FontPM should cache files.
# This directory will contain the local index files and all downloaded font files.
# If this is not provided, it will create a default at runtime.
cache_dir = " ~/.cache/fontpm "
# font_install_dir: path
# Path to the directory where installed fonts should reside.
# If this is not provided, it will create a default at runtime.
font_install_dir = " ~/.local/share/fonts/fontpm " FONTPM已获得Apache 2.0许可证的许可。您可以在许可证中找到文字。
Copyright (c) 2023 tecc
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.