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 roaming )。$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.