mirror of
https://github.com/ryanoasis/nerd-fonts.git
synced 2026-09-10 07:36:35 -04:00
Compare commits
46 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
33db50390a | ||
|
|
adf98be00e | ||
|
|
c34dbc5ef9 | ||
|
|
783197b868 | ||
|
|
480c4ec469 | ||
|
|
f21ddcf3c0 | ||
|
|
7e8b9e3297 | ||
|
|
2f740ec0c2 | ||
|
|
a09566d7f0 | ||
|
|
ed952eb41c | ||
|
|
74e2121584 | ||
|
|
939486b7bf | ||
|
|
e2181b5aab | ||
|
|
fb8391314d | ||
|
|
a48c26daac | ||
|
|
37cf5364af | ||
|
|
5663778d3b | ||
|
|
21e589a40c | ||
|
|
42d7ace109 | ||
|
|
428d713e24 | ||
|
|
e0bd379b8d | ||
|
|
bb6ae89ac2 | ||
|
|
acd0b490af | ||
|
|
b0137be3b7 | ||
|
|
2abb0b7ab1 | ||
|
|
b5ea9ed785 | ||
|
|
da6d7d80f2 | ||
|
|
40c6a2b718 | ||
|
|
f9e794dfbf | ||
|
|
523a8e1b44 | ||
|
|
38868a0092 | ||
|
|
2fa9b7ffac | ||
|
|
d9e8120472 | ||
|
|
fe14bb3b21 | ||
|
|
d2ac674146 | ||
|
|
3d80f94838 | ||
|
|
2b211fb430 | ||
|
|
ad2359a6c3 | ||
|
|
a33bad2e4c | ||
|
|
21f732211e | ||
|
|
0933f6d921 | ||
|
|
aee2a637c9 | ||
|
|
0faaeb3657 | ||
|
|
64a084f954 | ||
|
|
73e5da3b33 | ||
|
|
50d375afcd |
|
|
@ -2124,6 +2124,33 @@
|
|||
"contributions": [
|
||||
"bug"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "chrisemke",
|
||||
"name": "Krisque",
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/63082743?v=4",
|
||||
"profile": "https://codeberg.org/krisque/",
|
||||
"contributions": [
|
||||
"doc"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "return42",
|
||||
"name": "Markus Heiser",
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/554536?v=4",
|
||||
"profile": "https://github.com/return42",
|
||||
"contributions": [
|
||||
"code"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "laur89",
|
||||
"name": "laur89",
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/4551018?v=4",
|
||||
"profile": "https://github.com/laur89",
|
||||
"contributions": [
|
||||
"bug"
|
||||
]
|
||||
}
|
||||
],
|
||||
"repoType": "github",
|
||||
|
|
|
|||
|
|
@ -309,6 +309,9 @@ Thanks goes to these wonderful people ([emoji key](https://github.com/kentcdodds
|
|||
</tr>
|
||||
<tr>
|
||||
<td align="center" valign="top" width="14.28%"><a href="https://github.com/kStor2poche"><img src="https://avatars.githubusercontent.com/u/43518872?v=4?s=100" width="100px;" alt="kStor2poche"/><br /><sub><b>kStor2poche</b></sub></a><br /><a href="https://github.com/ryanoasis/nerd-fonts/issues?q=author%3AkStor2poche" title="Bug reports">🐛</a></td>
|
||||
<td align="center" valign="top" width="14.28%"><a href="https://codeberg.org/krisque/"><img src="https://avatars.githubusercontent.com/u/63082743?v=4?s=100" width="100px;" alt="Krisque"/><br /><sub><b>Krisque</b></sub></a><br /><a href="https://github.com/ryanoasis/nerd-fonts/commits?author=chrisemke" title="Documentation">📖</a></td>
|
||||
<td align="center" valign="top" width="14.28%"><a href="https://github.com/return42"><img src="https://avatars.githubusercontent.com/u/554536?v=4?s=100" width="100px;" alt="Markus Heiser"/><br /><sub><b>Markus Heiser</b></sub></a><br /><a href="https://github.com/ryanoasis/nerd-fonts/commits?author=return42" title="Code">💻</a></td>
|
||||
<td align="center" valign="top" width="14.28%"><a href="https://github.com/laur89"><img src="https://avatars.githubusercontent.com/u/4551018?v=4?s=100" width="100px;" alt="laur89"/><br /><sub><b>laur89</b></sub></a><br /><a href="https://github.com/ryanoasis/nerd-fonts/issues?q=author%3Alaur89" title="Bug reports">🐛</a></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
|
|
|||
BIN
FontPatcher.zip
BIN
FontPatcher.zip
Binary file not shown.
|
|
@ -831,7 +831,7 @@
|
|||
"unpatchedName": "OpenDyslexic",
|
||||
"licenseId": "Bitstream-Vera",
|
||||
"RFN": false,
|
||||
"version": "2.001",
|
||||
"version": "2.001/1.001",
|
||||
"patchedName": "OpenDyslexic",
|
||||
"folderName": "OpenDyslexic",
|
||||
"imagePreviewFont": "OpenDyslexic Nerd Font",
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
from __future__ import absolute_import, print_function, unicode_literals
|
||||
|
||||
# Change the script version when you edit this script:
|
||||
script_version = "4.27.2"
|
||||
script_version = "4.27.3"
|
||||
|
||||
version = "3.5.1"
|
||||
projectName = "Nerd Fonts"
|
||||
|
|
@ -1606,6 +1606,8 @@ class font_patcher:
|
|||
indexoffset = self.copy_glyphs_last['maximum']
|
||||
else:
|
||||
indexoffset = 0
|
||||
if self.args.progressbars and len(self.copy_glyphs_last['header']):
|
||||
sys.stdout.write("\n")
|
||||
|
||||
for index, sym_glyph in enumerate(symbolFontSelection):
|
||||
|
||||
|
|
@ -1862,8 +1864,6 @@ class font_patcher:
|
|||
# end for
|
||||
self.copy_glyphs_last['header'] = progressHeader
|
||||
self.copy_glyphs_last['maximum'] = glyphSetLength + indexoffset
|
||||
if self.args.progressbars and len(self.copy_glyphs_last['header']):
|
||||
sys.stdout.write("\n")
|
||||
|
||||
|
||||
def set_sourcefont_glyph_widths(self):
|
||||
|
|
|
|||
62
install.ps1
62
install.ps1
|
|
@ -1,62 +0,0 @@
|
|||
#Requires -Version 3.0
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Installs the provided fonts.
|
||||
.DESCRIPTION
|
||||
Installs all the provided fonts by default. The FontName
|
||||
parameter can be used to pick a subset of fonts to install.
|
||||
.EXAMPLE
|
||||
C:\PS> ./install.ps1
|
||||
Installs all the fonts located in the Git repository.
|
||||
.EXAMPLE
|
||||
C:\PS> ./install.ps1 FiraCode, Hack
|
||||
Installs all the FiraCode and Hack fonts.
|
||||
.EXAMPLE
|
||||
C:\PS> ./install.ps1 DejaVuSansMono -WhatIf
|
||||
Shows which fonts would be installed without actually installing the fonts.
|
||||
Remove the "-WhatIf" to install the fonts.
|
||||
#>
|
||||
[CmdletBinding(SupportsShouldProcess)]
|
||||
param ()
|
||||
|
||||
dynamicparam {
|
||||
$Attributes = [Collections.ObjectModel.Collection[Attribute]]::new()
|
||||
$ParamAttribute = [Parameter]::new()
|
||||
$ParamAttribute.Position = 0
|
||||
$ParamAttribute.ParameterSetName = '__AllParameterSets'
|
||||
$Attributes.Add($ParamAttribute)
|
||||
|
||||
[string[]]$FontNames = Join-Path $PSScriptRoot patched-fonts | Get-ChildItem -Directory -Name
|
||||
$Attributes.Add([ValidateSet]::new(($FontNames)))
|
||||
|
||||
$Parameter = [Management.Automation.RuntimeDefinedParameter]::new('FontName', [string[]], $Attributes)
|
||||
$RuntimeParams = [Management.Automation.RuntimeDefinedParameterDictionary]::new()
|
||||
$RuntimeParams.Add('FontName', $Parameter)
|
||||
|
||||
return $RuntimeParams
|
||||
}
|
||||
|
||||
end {
|
||||
$FontName = $PSBoundParameters.FontName
|
||||
if (-not $FontName) {$FontName = '*'}
|
||||
|
||||
$fontFiles = [Collections.Generic.List[System.IO.FileInfo]]::new()
|
||||
|
||||
Join-Path $PSScriptRoot patched-fonts | Push-Location
|
||||
foreach ($aFontName in $FontName) {
|
||||
Get-ChildItem $aFontName -Filter "*.ttf" -Recurse | Foreach-Object {$fontFiles.Add($_)}
|
||||
Get-ChildItem $aFontName -Filter "*.otf" -Recurse | Foreach-Object {$fontFiles.Add($_)}
|
||||
}
|
||||
Pop-Location
|
||||
|
||||
$fonts = $null
|
||||
foreach ($fontFile in $fontFiles) {
|
||||
if ($PSCmdlet.ShouldProcess($fontFile.Name, "Install Font")) {
|
||||
if (!$fonts) {
|
||||
$shellApp = New-Object -ComObject shell.application
|
||||
$fonts = $shellApp.NameSpace(0x14)
|
||||
}
|
||||
$fonts.CopyHere($fontFile.FullName)
|
||||
}
|
||||
}
|
||||
}
|
||||
724
install.sh
724
install.sh
|
|
@ -1,265 +1,519 @@
|
|||
#!/usr/bin/env bash
|
||||
# Install Nerd Fonts
|
||||
__ScriptVersion="1.0"
|
||||
|
||||
# Installer to install or update the NerdFonts [1] from the
|
||||
# GitHub releases [2].
|
||||
#
|
||||
# Usage:
|
||||
#
|
||||
# $ curl -s https://raw.githubusercontent.com/ryanoasis/nerd-fonts/master/install.sh -o install.sh
|
||||
# $ chmod ugo+x install.sh
|
||||
# $ ./install.sh --help
|
||||
#
|
||||
# Developer notes:
|
||||
#
|
||||
# $ shfmt -i 4 -w install.sh
|
||||
# $ shellcheck install.sh
|
||||
#
|
||||
# [1] https://www.nerdfonts.com/
|
||||
# [2] https://github.com/ryanoasis/nerd-fonts/releases
|
||||
|
||||
# SPDX-License-Identifier: MIT
|
||||
# Author: Markus Heiser <markus.heiser@darmarit.de>
|
||||
# Keywords: NerdFonts
|
||||
#
|
||||
scriptversion="2.0.1"
|
||||
# Nerd Fonts Version: 3.5.0
|
||||
|
||||
# shellcheck enable=require-variable-braces
|
||||
|
||||
# This script must run with bash 3
|
||||
# In fact it is checked against `checkbashisms` and no bashisms are
|
||||
# used, except (because the workarounds are too involved):
|
||||
# - Regexes
|
||||
# - FUNCNAME
|
||||
#
|
||||
# - read -d option
|
||||
# - $'\0' to supply a nullbyte to read -d
|
||||
#
|
||||
# Note that `find` on MacOS does not know `-printf` and cp/ln have no `-T` or `-t`
|
||||
# Note that some tools on MacOS behave differently or have unfamiliar options
|
||||
# and that also needs to be checked
|
||||
|
||||
# Default values for option variables:
|
||||
quiet=false
|
||||
mode="copy"
|
||||
clean=false
|
||||
dry=false
|
||||
extension1="otf"
|
||||
extension2="ttf"
|
||||
variant="R"
|
||||
installpath="user"
|
||||
set -euo pipefail
|
||||
if shopt | grep -q inherit_errexit; then
|
||||
shopt -s inherit_errexit
|
||||
fi
|
||||
|
||||
# Usage info
|
||||
usage() {
|
||||
cat << EOF
|
||||
Usage: ./install.sh [-q -v -h] [[--copy | --link] --clean | --list | --remove]
|
||||
[--mono] [--use-proportional-glyphs] [--otf | --ttf]
|
||||
[--install-to-user-path | --install-to-system-path ]
|
||||
[FONT...]
|
||||
# environment
|
||||
# -----------
|
||||
|
||||
General options:
|
||||
VERBOSE="${VERBOSE:-1}"
|
||||
TERM="${TERM:-}"
|
||||
# https://docs.github.com/de/rest/releases/releases?#get-a-release-by-tag-name
|
||||
GH_API_VERSION="${GH_API_VERSION:-2022-11-28}"
|
||||
GH_RELEASE_TAG="${GH_RELEASE_TAG:-latest}"
|
||||
GH_OWNER="${GH_OWNER:-ryanoasis}"
|
||||
GH_REPO="${GH_REPO:-nerd-fonts}"
|
||||
GH_TOKEN="${GH_TOKEN:-}"
|
||||
FONT_FORMATS="${FONT_FORMATS:-ttf|otf}"
|
||||
|
||||
-q, --quiet Suppress output.
|
||||
-v, --version Print version number and exit.
|
||||
-h, --help Display this help and exit.
|
||||
# Get target font directory
|
||||
if [ "$(uname)" = "Darwin" ]; then
|
||||
# MacOS
|
||||
sys_share_dir="/Library"
|
||||
usr_share_dir="${HOME}/Library"
|
||||
font_subdir="Fonts"
|
||||
else
|
||||
# Linux
|
||||
sys_share_dir="/usr/local/share"
|
||||
usr_share_dir="${HOME}/.local/share"
|
||||
font_subdir="fonts"
|
||||
fi
|
||||
XDG_DATA_HOME="${XDG_DATA_HOME:-}"
|
||||
if [ -n "${XDG_DATA_HOME}" ]; then
|
||||
usr_share_dir="${XDG_DATA_HOME}"
|
||||
fi
|
||||
if [ ${EUID:-0} -ne 0 ] || [ "$(id -u)" -ne 0 ]; then
|
||||
FONT_DIR="${FONT_DIR:-${usr_share_dir}/${font_subdir}/NerdFonts}"
|
||||
else
|
||||
FONT_DIR="${FONT_DIR:-${sys_share_dir}/${font_subdir}/NerdFonts}"
|
||||
fi
|
||||
|
||||
-c, --copy Copy the font files [default].
|
||||
-l, --link Symlink the font files.
|
||||
-L, --list List the font files to be installed (dry run).
|
||||
_REQUIREMENTS="curl mktemp sed tar wc"
|
||||
_GH_RELEASE_DATA=
|
||||
_GH_ASSET_DATA=
|
||||
|
||||
-C, --clean Recreate the root Nerd Fonts target directory
|
||||
(clean out all previous copies or symlinks).
|
||||
# command line interface
|
||||
# ----------------------
|
||||
|
||||
--remove Remove all Nerd Fonts (that have been installed
|
||||
with this script).
|
||||
Can be combined with -L for a dry run.
|
||||
cmd_help() {
|
||||
cat <<EOF
|
||||
Usage: $(basename "$0") <cmd>
|
||||
|
||||
-s, --mono Install single-width glyphs variants.
|
||||
-p, --use-proportional-glyphs Install proportional glyphs variants.
|
||||
Install and update Nerd Fonts [1] from the GitHub releases [2].
|
||||
See \`$(basename "$0") install --help\` for details.
|
||||
|
||||
-U, --install-to-user-path Install fonts to users home font path [default].
|
||||
-S, --install-to-system-path Install fonts to global system path for all users, requires root.
|
||||
[1] https://www.nerdfonts.com/
|
||||
[2] https://github.com/${GH_OWNER}/${GH_REPO}/releases
|
||||
|
||||
-O, --otf Prefer OTF font files [default].
|
||||
-T, --ttf Prefer TTF font files.
|
||||
cmd:
|
||||
help : show this help message
|
||||
env : show environment
|
||||
list : list released fonts
|
||||
install : selectively install (or update) a font or *all* fonts
|
||||
remove : uninstall all Nerd Fonts
|
||||
|
||||
required tools:
|
||||
${_REQUIREMENTS}
|
||||
EOF
|
||||
}
|
||||
|
||||
# Print version
|
||||
version() {
|
||||
echo "Nerd Fonts installer -- Version $__ScriptVersion"
|
||||
echo " -- Bash ${BASH_VERSION}"
|
||||
echo
|
||||
echo "Deprecated tool: Will not work to get newer fonts as they are not inside the repo anymore."
|
||||
cmd_install_help() {
|
||||
cat <<EOF
|
||||
Usage: $(basename "$0") install [<fontname>|all]
|
||||
|
||||
fontname:
|
||||
The name of the font to be installed can be specified, or 'all' can be
|
||||
specified to install all fonts.
|
||||
|
||||
Selectively install one font or *all* fonts to FONT_DIR.
|
||||
|
||||
If no argument is given a list of available fonts will be displayed,
|
||||
and a font can be selected from the list.
|
||||
|
||||
By default the user font directory is used; run script as root for a
|
||||
system wide install.
|
||||
|
||||
The target directory is determined to be
|
||||
${FONT_DIR}
|
||||
EOF
|
||||
}
|
||||
cmd_install() {
|
||||
local font_name="${1-}"
|
||||
local tmp_folder
|
||||
local font_list
|
||||
local font_list_size
|
||||
|
||||
# Parse options
|
||||
optspec=":qvhclLCspOTUS-:"
|
||||
while getopts "$optspec" optchar; do
|
||||
case "${optchar}" in
|
||||
font_list=$(nerd_font_list)
|
||||
# shellcheck disable=SC2086 # We actually need word splitting of font_list here
|
||||
font_list_size=$(sh_count ${font_list})
|
||||
|
||||
# Short options
|
||||
q) quiet=true;;
|
||||
v) version; exit 0;;
|
||||
h) usage; exit 0;;
|
||||
c) mode="copy";;
|
||||
l) mode="link";;
|
||||
L) dry=true
|
||||
[ "$mode" != "remove" ] && mode="list";;
|
||||
C) clean=true;;
|
||||
s) variant="M";;
|
||||
p) variant="P";;
|
||||
O) extension1="otf"; extension2="ttf";;
|
||||
T) extension1="ttf"; extension2="otf";;
|
||||
S) installpath="system";;
|
||||
U) installpath="user";;
|
||||
|
||||
-)
|
||||
case "${OPTARG}" in
|
||||
# Long options
|
||||
quiet) quiet=true;;
|
||||
version) version; exit 0;;
|
||||
help) usage; exit 0;;
|
||||
copy) mode="copy";;
|
||||
link) mode="link";;
|
||||
list) dry=true
|
||||
[ "$mode" != "remove" ] && mode="list";;
|
||||
remove) mode="remove";;
|
||||
clean) clean=true;;
|
||||
mono) variant="M";;
|
||||
use-proportional-glyphs) variant="P";;
|
||||
otf) extension1="otf"; extension2="ttf";;
|
||||
ttf) extension1="ttf"; extension2="otf";;
|
||||
install-to-system-path) installpath="system";;
|
||||
install-to-user-path) installpath="user";;
|
||||
*)
|
||||
echo "Unknown option --${OPTARG}" >&2
|
||||
usage >&2;
|
||||
exit 1
|
||||
;;
|
||||
esac;;
|
||||
|
||||
*)
|
||||
echo "Unknown option -${OPTARG}" >&2
|
||||
usage >&2
|
||||
exit 1
|
||||
;;
|
||||
|
||||
esac
|
||||
done
|
||||
shift $((OPTIND-1))
|
||||
|
||||
version
|
||||
|
||||
# Set source and target directories, default: all fonts
|
||||
sd="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 || exit ; pwd -P )"
|
||||
nerdfonts_root_dir="${sd}/patched-fonts"
|
||||
|
||||
# Accept font / directory names, to avoid installing all fonts
|
||||
if [ -n "$*" ]; then
|
||||
nerdfonts_dirs=
|
||||
for font in "${@}"; do
|
||||
if [ -n "$font" ]; then
|
||||
# Ensure that directory exists, and offer suggestions if not
|
||||
if [ ! -d "$nerdfonts_root_dir/$font" ]; then
|
||||
echo "Font $font doesn't exist. Options are:"
|
||||
echo
|
||||
find "$nerdfonts_root_dir" -mindepth 1 -maxdepth 1 -type d -exec basename "{}" \; | sort
|
||||
exit 255
|
||||
fi
|
||||
nerdfonts_dirs="${nerdfonts_dirs}${font}/"
|
||||
fi
|
||||
done
|
||||
else
|
||||
nerdfonts_dirs=$(find "${nerdfonts_root_dir}" -mindepth 1 -maxdepth 1 -type d -print0 | sed "s|${nerdfonts_root_dir}/||g" | tr '\0' '/')
|
||||
fi
|
||||
# nerdfonts_dirs contains a '/' separated list of directories directly
|
||||
# under nerdfonts_root_dir to look at (it needs to end in '/')
|
||||
|
||||
# Which Nerd Font variant
|
||||
if [ "$variant" = "M" ]; then
|
||||
find_filter="-name '*NerdFontMono*'"
|
||||
elif [ "$variant" = "P" ]; then
|
||||
find_filter="-name '*NerdFontPropo*'"
|
||||
else
|
||||
find_filter="-not -name '*NerdFontMono*' -and -not -name '*NerdFontPropo*' -and -name '*NerdFont*'"
|
||||
fi
|
||||
|
||||
collect_files() {
|
||||
# Find all the font files, return \0 separated list
|
||||
echo "${nerdfonts_dirs}" | while IFS= read -d / -r dir; do
|
||||
if [ -n "$(echo "${find_filter}" | xargs -- find "${nerdfonts_root_dir}/${dir}" -iname "*.${extension1}" -type f)" ]; then
|
||||
echo "${find_filter} -print0" | xargs -- find "${nerdfonts_root_dir}/${dir}" -iname "*.${extension1}" -type f
|
||||
if [ "${font_name}" = "all" ]; then
|
||||
msg_info "install all ${font_list_size} fonts"
|
||||
msg_warn "installing all fonts will take its time / time for a coffee break"
|
||||
elif [ "${font_name}" = "" ]; then
|
||||
PS3="Enter a number: "
|
||||
select font_name in ${font_list} "all"; do
|
||||
# shellcheck disable=SC2086 # We actually need word splitting of font_list here in the else
|
||||
if [ "${font_name}" = "all" ]; then
|
||||
msg_info "install all ${font_list_size} fonts"
|
||||
msg_warn "installing all fonts will take its time / time for a coffee break"
|
||||
break
|
||||
elif sh_in_array "${font_name}" ${font_list}; then
|
||||
font_list="${font_name}"
|
||||
break
|
||||
else
|
||||
msg_err "invalid choice."
|
||||
fi
|
||||
done
|
||||
msg_debug "user selected font ${font_name}"
|
||||
else
|
||||
echo "${find_filter} -print0" | xargs -- find "${nerdfonts_root_dir}/${dir}" -iname "*.${extension2}" -type f
|
||||
# shellcheck disable=SC2086 # We actually need word splitting of font_list here
|
||||
sh_in_array "${font_name}" ${font_list} ||
|
||||
sh_die_err 42 "font ${font_name} does not exists in release ${GH_RELEASE_TAG}"
|
||||
font_list="${font_name}"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
# Get target root directory
|
||||
if [ "$(uname)" = "Darwin" ]; then
|
||||
# MacOS
|
||||
sys_share_dir="/Library"
|
||||
usr_share_dir="$HOME/Library"
|
||||
font_subdir="Fonts"
|
||||
else
|
||||
# Linux
|
||||
sys_share_dir="/usr/local/share"
|
||||
usr_share_dir="$HOME/.local/share"
|
||||
font_subdir="fonts"
|
||||
fi
|
||||
if [ -n "${XDG_DATA_HOME}" ]; then
|
||||
usr_share_dir="${XDG_DATA_HOME}"
|
||||
fi
|
||||
sys_font_dir="${sys_share_dir}/${font_subdir}/NerdFonts"
|
||||
usr_font_dir="${usr_share_dir}/${font_subdir}/NerdFonts"
|
||||
|
||||
if [ "system" = "$installpath" ]; then
|
||||
font_dir="${sys_font_dir}"
|
||||
else
|
||||
font_dir="${usr_font_dir}"
|
||||
fi
|
||||
|
||||
if [ -z "$(collect_files | tr -d '\0')" ]; then
|
||||
echo "Did not find any fonts to install"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
prepare_dirs() {
|
||||
if [ "$clean" = true ]; then
|
||||
[ "$quiet" = false ] && rm -rfv "$font_dir"
|
||||
[ "$quiet" = true ] && rm -rf "$font_dir"
|
||||
fi
|
||||
[ "$quiet" = false ] && mkdir -pv "$font_dir"
|
||||
[ "$quiet" = true ] && mkdir -p "$font_dir"
|
||||
}
|
||||
|
||||
#
|
||||
# Take the desired action
|
||||
#
|
||||
case $mode in
|
||||
|
||||
list)
|
||||
collect_files | while IFS= read -d $'\0' -r file; do
|
||||
file=$(basename "$file")
|
||||
echo "$font_dir/${file#"$nerdfonts_root_dir"/}"
|
||||
msg_info "install fonts into folder: ${FONT_DIR}"
|
||||
tmp_folder="$(mktemp -d)"
|
||||
msg_debug "Workdir ${tmp_folder}"
|
||||
cd -- "${tmp_folder}" >/dev/null 2>&1 || sh_die_err 42 "can't cd ${tmp_folder}"
|
||||
for font in ${font_list}; do
|
||||
nerd_install_font "${font}"
|
||||
done
|
||||
exit 0
|
||||
;;
|
||||
|
||||
copy)
|
||||
prepare_dirs
|
||||
[ "$quiet" = false ] && (collect_files | xargs --null "-I{}" -- cp -fv "{}" "$font_dir")
|
||||
[ "$quiet" = true ] && (collect_files | xargs --null "-I{}" -- cp -f "{}" "$font_dir")
|
||||
;;
|
||||
link)
|
||||
prepare_dirs
|
||||
[ "$quiet" = false ] && (collect_files | xargs --null "-I{}" -- ln -sfv "{}" "$font_dir")
|
||||
[ "$quiet" = true ] && (collect_files | xargs --null "-I{}" -- ln -sf "{}" "$font_dir")
|
||||
;;
|
||||
|
||||
remove)
|
||||
if [ "true" = "$dry" ]; then
|
||||
echo "Dry run. Would issue these commands:"
|
||||
[ "$quiet" = false ] && echo rm -rfv "$sys_font_dir" "$usr_font_dir"
|
||||
[ "$quiet" = true ] && echo rm -rf "$sys_font_dir" "$usr_font_dir"
|
||||
else
|
||||
[ "$quiet" = false ] && rm -rfv "$sys_font_dir" "$usr_font_dir"
|
||||
[ "$quiet" = true ] && rm -rf "$sys_font_dir" "$usr_font_dir"
|
||||
cd - >/dev/null 2>&1
|
||||
rm -rf -- "${tmp_folder}"
|
||||
if command fc-cache; then
|
||||
msg_info "fontconfig: build font information cache files"
|
||||
fc-cache
|
||||
fi
|
||||
font_dir="$sys_font_dir $usr_font_dir"
|
||||
;;
|
||||
}
|
||||
|
||||
esac
|
||||
cmd_remove_help() {
|
||||
cat <<EOF
|
||||
Usage: $(basename "$0") remove
|
||||
|
||||
# Reset font cache on Linux
|
||||
if [ -n "$(command -v fc-cache)" ]; then
|
||||
if [ "true" = "$dry" ]; then
|
||||
[ "$quiet" = false ] && echo fc-cache -vf "$font_dir"
|
||||
[ "$quiet" = true ] && echo fc-cache -f "$font_dir"
|
||||
else
|
||||
[ "$quiet" = false ] && fc-cache -vf "$font_dir"
|
||||
[ "$quiet" = true ] && fc-cache -f "$font_dir"
|
||||
fi
|
||||
case $? in
|
||||
[0-1])
|
||||
# Catch fc-cache returning 1 on a success
|
||||
exit 0
|
||||
;;
|
||||
*)
|
||||
exit $?
|
||||
;;
|
||||
esac
|
||||
Uninstall all previous installed Nerd Fonts.
|
||||
In fact purging the directory ${FONT_DIR}
|
||||
EOF
|
||||
}
|
||||
|
||||
cmd_remove() {
|
||||
[ "$#" -ne 0 ] && sh_die_err 42 "${FUNCNAME#"cmd."}: unknown arguments $*"
|
||||
if [ -d "${FONT_DIR}" ]; then
|
||||
msg_info "remove font folder ${FONT_DIR}"
|
||||
rm -rf "${FONT_DIR}"
|
||||
if command fc-cache; then
|
||||
msg_info "fontconfig: build font information cache files"
|
||||
fc-cache
|
||||
fi
|
||||
else
|
||||
msg_err "Nerd Fonts not installed at ${FONT_DIR}"
|
||||
fi
|
||||
}
|
||||
|
||||
cmd_list() {
|
||||
[ "$#" -ne 0 ] && sh_die_err 42 "${FUNCNAME#"cmd."}: unknown arguments $*"
|
||||
if [ "${GH_RELEASE_TAG}" = "latest" ]; then
|
||||
GH_RELEASE_TAG="$(gh_latest_release)"
|
||||
msg_info "${GH_OWNER}/${GH_REPO}: latest (${GH_RELEASE_TAG})"
|
||||
else
|
||||
msg_info "${GH_OWNER}/${GH_REPO}: ${GH_RELEASE_TAG}"
|
||||
fi
|
||||
nerd_font_list
|
||||
}
|
||||
|
||||
cmd_env() {
|
||||
[ "$#" -ne 0 ] && sh_die_err 42 "${FUNCNAME#"cmd."}: unknown arguments $*"
|
||||
cat <<EOF
|
||||
You can set these variables, and the current values are:
|
||||
VERBOSE=${VERBOSE}
|
||||
GH_API_VERSION=${GH_API_VERSION}
|
||||
GH_RELEASE_TAG=${GH_RELEASE_TAG}
|
||||
GH_OWNER=${GH_OWNER}
|
||||
GH_REPO=${GH_REPO}
|
||||
GH_TOKEN=${GH_TOKEN}
|
||||
FONT_DIR=${FONT_DIR}
|
||||
FONT_FORMATS=${FONT_FORMATS}
|
||||
XDG_DATA_HOME=${XDG_DATA_HOME}
|
||||
TERM=${TERM}
|
||||
|
||||
VERBOSE can be set to
|
||||
0 : silent
|
||||
1 : info
|
||||
2 : debug
|
||||
3 : deep debug
|
||||
EOF
|
||||
}
|
||||
|
||||
# Nerd Fonts
|
||||
# ----------
|
||||
|
||||
nerd_assemble_released_archives() {
|
||||
# Returns pairs of "Archive-basename asset-ID"
|
||||
local archive_suffix=.tar.xz
|
||||
local assets_regex="^ *\"assets\":"
|
||||
local aid_regex="^ *\"id\":"
|
||||
local name_regex="^ *\"name\":"
|
||||
local end1_regex="^ *},$"
|
||||
local end2_regex="^ *],$"
|
||||
local extract_id='s/[^:]*: *\([0-9a-zA-Z]*\).*/\1/'
|
||||
local extract_string='s/[^:]*[^"]*"\([^"]*\).*/\1/'
|
||||
local assets_started=
|
||||
local aid=
|
||||
local name=
|
||||
msg_debug "nerd_assemble_released_archives() for ${archive_suffix}"
|
||||
gh_release_data |
|
||||
while IFS= read -r line; do
|
||||
[ -z "${assets_started}" ] && [[ ! "${line}" =~ ${assets_regex} ]] && continue
|
||||
assets_started=true
|
||||
[[ "${line}" =~ ${end2_regex} ]] && break # end of assets
|
||||
|
||||
if [[ "${line}" =~ ${aid_regex} ]] && [ -z "${aid}" ]; then
|
||||
aid=$(echo "${line}" | sed "${extract_id}")
|
||||
fi
|
||||
if [[ "${line}" =~ ${name_regex} ]]; then
|
||||
name=$(echo "${line}" | sed "${extract_string}")
|
||||
fi
|
||||
if [[ "${line}" =~ ${end1_regex} ]] && [ -n "${aid}" ]; then
|
||||
# Select only one suffix
|
||||
if [[ "${name}" == *"${archive_suffix}" ]]; then
|
||||
printf "%s|%s\n" "${name%"${archive_suffix}"}" "${aid}"
|
||||
fi
|
||||
aid=
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
nerd_released_archives() {
|
||||
_GH_ASSET_DATA="${_GH_ASSET_DATA:-$(nerd_assemble_released_archives)}"
|
||||
printf "%s\n" "${_GH_ASSET_DATA}"
|
||||
}
|
||||
|
||||
nerd_font_list() {
|
||||
nerd_released_archives |
|
||||
while IFS= read -r line; do
|
||||
if [[ "${line}" == *FontPatcher* ]]; then
|
||||
continue
|
||||
fi
|
||||
echo "${line%%|*}"
|
||||
done
|
||||
}
|
||||
|
||||
nerd_find_asset_id() {
|
||||
local aid=
|
||||
nerd_released_archives |
|
||||
while IFS= read -r line; do
|
||||
if [ "${line%%|*}" = "${1}" ]; then
|
||||
echo "${line#*|}"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
nerd_install_font() {
|
||||
# usage: nerd_install_font <font name>
|
||||
|
||||
local aid
|
||||
aid=$(nerd_find_asset_id "${1}")
|
||||
if [ -z "${aid}" ]; then
|
||||
sh_die_err 42 "Can not find asset ID of ${1}"
|
||||
fi
|
||||
msg_info "download & install font: ${1} (asset ${aid})"
|
||||
(
|
||||
set -e
|
||||
local dst
|
||||
gh_download_asset "${1}.tar.xz" "${aid}"
|
||||
mkdir -p "${1}"
|
||||
tar xf "${1}.tar.xz" -C "${1}"
|
||||
mkdir -p "${FONT_DIR}"
|
||||
local found_one=
|
||||
for filename in "${1}"/*; do
|
||||
if [[ "${filename##*.}" =~ ${FONT_FORMATS} ]]; then
|
||||
dst="${FONT_DIR}/$(basename "${filename}")"
|
||||
msg_debug "install font: ${dst}"
|
||||
mv "${filename}" "${dst}"
|
||||
found_one=true
|
||||
fi
|
||||
done
|
||||
if [ -z "${found_one}" ]; then
|
||||
msg_warn "no font file matching \"${FONT_FORMATS}\" for ${1}"
|
||||
fi
|
||||
)
|
||||
sh_prompt_err $?
|
||||
}
|
||||
|
||||
# github tools
|
||||
# ------------
|
||||
|
||||
gh_latest_release() {
|
||||
msg_debug "gh_latest_release() URL https://github.com/${GH_OWNER}/${GH_REPO}/releases/latest"
|
||||
basename "$(curl -H "${AUTH}" -fs -o/dev/null -w "%{redirect_url}" "https://github.com/${GH_OWNER}/${GH_REPO}/releases/latest")"
|
||||
}
|
||||
|
||||
gh_release_data() {
|
||||
gh_release_tag
|
||||
if [ "${_GH_RELEASE_DATA}" = "" ]; then
|
||||
_GH_RELEASE_DATA="$(gh_get_release_data)"
|
||||
fi
|
||||
if echo "${_GH_RELEASE_DATA}" | grep -q '"message": "Not Found"' >/dev/null 2>&1; then
|
||||
msg_debug "release data: ${_GH_RELEASE_DATA}"
|
||||
sh_die_err 42 "release tag ${GH_RELEASE_TAG} does not exists"
|
||||
fi
|
||||
if echo "${_GH_RELEASE_DATA}" | grep -q '"message":"API rate limit exceeded' >/dev/null 2>&1; then
|
||||
msg_debug "release data: ${_GH_RELEASE_DATA}"
|
||||
sh_die_err 42 "GitHub API rate limit exceeded. Wait or use GH_TOKEN."
|
||||
fi
|
||||
echo "${_GH_RELEASE_DATA}"
|
||||
}
|
||||
|
||||
gh_release_tag() {
|
||||
if [ "${GH_RELEASE_TAG}" = "latest" ]; then
|
||||
GH_RELEASE_TAG="$(gh_latest_release)"
|
||||
fi
|
||||
echo "${GH_RELEASE_TAG}"
|
||||
}
|
||||
|
||||
gh_get_release_data() {
|
||||
local url
|
||||
url="https://api.github.com/repos/${GH_OWNER}/${GH_REPO}/releases/tags/$(gh_release_tag)"
|
||||
msg_debug "gh_get_release_data() URL ${url}"
|
||||
curl --silent -L \
|
||||
-H "Accept: application/vnd.github+json" \
|
||||
-H "X-GitHub-Api-Version: ${GH_API_VERSION}" \
|
||||
-H "${AUTH}" \
|
||||
"${url}"
|
||||
}
|
||||
|
||||
gh_download_asset() {
|
||||
# usage: gh_download_asset <target file name> <asset id>
|
||||
|
||||
local fname="${1}"
|
||||
local aid="${2}"
|
||||
local url
|
||||
local filesize
|
||||
|
||||
url="https://api.github.com/repos/${GH_OWNER}/${GH_REPO}/releases/assets/${aid}"
|
||||
msg_debug "gh_download_asset URL ${url}"
|
||||
curl --silent -L \
|
||||
-H "Accept: application/octet-stream" \
|
||||
-H "X-GitHub-Api-Version: ${GH_API_VERSION}" \
|
||||
-H "${AUTH}" \
|
||||
"${url}" -o "${fname}" || sh_die_err $? "can't download ${url}"
|
||||
|
||||
# check if the response from GH is just a "Not Found"
|
||||
filesize=$(wc -c <"${fname}")
|
||||
if [ "${filesize}" -ge 30 ]; then
|
||||
if head -c 30 "${fname}" | grep -q "Not Found"; then
|
||||
msg_err "Asset Not Found: ${url}"
|
||||
return 42
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# script helpers
|
||||
# --------------
|
||||
|
||||
msg_err() {
|
||||
printf "${_BRed}ERROR:${_creset} %s\n" "$*" >&2
|
||||
return 0
|
||||
}
|
||||
msg_warn() {
|
||||
printf "${_BBlue}WARN:${_creset} %s\n" "$*" >&2
|
||||
return 0
|
||||
}
|
||||
msg_info() {
|
||||
if [ "${VERBOSE}" -ge 1 ]; then
|
||||
printf "${_BGreen}INFO:${_creset} %s\n" "$*" >&2
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
msg_debug() {
|
||||
if [ "${VERBOSE}" -ge 2 ]; then
|
||||
printf "${_BYellow}DEBUG:${_creset} %s\n" "$*" >&2
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
|
||||
sh_die_err() {
|
||||
msg_err "(${1-1}) ${2-died} "
|
||||
exit "${1-1}"
|
||||
}
|
||||
|
||||
sh_prompt_err() {
|
||||
## Use this as last command in your function to prompt an ERROR message if
|
||||
## the exit code is not zero.
|
||||
local err=${1}
|
||||
[ "${err}" -ne 0 ] && msg_err "${FUNCNAME[1]} exit with error (${err})"
|
||||
return "${err}"
|
||||
}
|
||||
|
||||
sh_in_array() {
|
||||
local word="${1}"
|
||||
shift
|
||||
for e in "$@"; do [ "${e}" = "${word}" ] && return 0; done
|
||||
return 1
|
||||
}
|
||||
|
||||
sh_count() {
|
||||
echo $#
|
||||
}
|
||||
|
||||
scripts_requires() {
|
||||
local exit_val=0
|
||||
while [ -n "${1-}" ]; do
|
||||
if ! command -v "${1}" >/dev/null 2>&1; then
|
||||
msg_err "missing command ${1}"
|
||||
exit_val=42
|
||||
fi
|
||||
shift
|
||||
done
|
||||
return "${exit_val}"
|
||||
}
|
||||
|
||||
main() {
|
||||
local cmd="${1:-help}"
|
||||
shift || true
|
||||
# shellcheck disable=SC2086 # We actually need word splitting of _REQUIREMENTS here
|
||||
scripts_requires ${_REQUIREMENTS} || sh_die_err $? "first install missing requirements"
|
||||
|
||||
if [ -n "${GH_TOKEN}" ]; then
|
||||
msg_debug "Using Github token to avoid rate limits and allow draft downloads"
|
||||
AUTH="Authorization: Bearer ${GH_TOKEN}"
|
||||
else
|
||||
AUTH="X-noop;"
|
||||
fi
|
||||
|
||||
if [ "${cmd}" = "help" ] || [ "${cmd}" = "--help" ]; then
|
||||
cmd_help
|
||||
else
|
||||
if [ "${cmd}" = "list" ] || [ "${cmd}" = "install" ]; then
|
||||
# Needed to fill 'cache' environment variables:
|
||||
gh_release_data >/dev/null
|
||||
nerd_released_archives >/dev/null
|
||||
fi
|
||||
_type="$(type -t "cmd_${cmd}")" || true
|
||||
if [ "${_type}" != "function" ]; then
|
||||
sh_die_err 42 "unknown command: ${cmd} / use --help"
|
||||
fi
|
||||
|
||||
if [ "${1-}" = '--help' ]; then
|
||||
_type="$(type -t "cmd_${cmd}_help")" || true
|
||||
if [ "${_type}" = 'function' ]; then
|
||||
"cmd_${cmd}_help"
|
||||
else
|
||||
"cmd_help"
|
||||
fi
|
||||
else
|
||||
[ "${VERBOSE}" -ge 3 ] && set -x
|
||||
"cmd_${cmd}" "$@"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
echo "Nerd Fonts installer -- Version ${scriptversion}"
|
||||
echo " -- Bash ${BASH_VERSION}"
|
||||
|
||||
if [ ! -t 2 ] ||
|
||||
[ "${TERM:-unknown}" = "unknown" ] ||
|
||||
[ "${TERM}" = "dumb" ] ||
|
||||
[ -n "${NO_COLOR:-}" ]; then
|
||||
_BYellow=''
|
||||
_BBlue=''
|
||||
_BRed=''
|
||||
_BGreen=''
|
||||
_creset=''
|
||||
else
|
||||
_BYellow='\e[1;33m'
|
||||
_BBlue='\e[1;94m'
|
||||
_BRed='\e[1;31m'
|
||||
_BGreen='\e[1;32m'
|
||||
_creset='\e[0m'
|
||||
fi
|
||||
|
||||
main "$@"
|
||||
|
|
|
|||
151
readme.md
151
readme.md
|
|
@ -28,7 +28,7 @@ The following flow diagram shows the current glyph sets included:
|
|||
|
||||
## Important Notices
|
||||
* `master` branch file paths are **not** considered stable. [Verify your repository URI references](#unstable-file-paths)
|
||||
* cloning this repository is **not** recommended ([due to Repo size](#option-9-clone-the-repo)) unless you are going to be [contributing to development](#contributing)
|
||||
* cloning this repository is **not** recommended ([due to Repo size](#option-8-clone-the-repo)) unless you are going to be [contributing to development](#contributing)
|
||||
|
||||
|
||||
## Table of Contents
|
||||
|
|
@ -37,15 +37,14 @@ The following flow diagram shows the current glyph sets included:
|
|||
|
||||
[**Installation Options**](#font-installation)
|
||||
* [**1 - Release Archive Download**](#option-1-release-archive-download)
|
||||
* [**2 - Homebrew Fonts (macOS (OS X))**](#option-2-homebrew-fonts)
|
||||
* [**3 - Chocolatey or Scoop (Windows)**](#option-3-unofficial-chocolatey-or-scoop-repositories)
|
||||
* [**4 - Arch Linux Repository (Extra, AUR)**](#option-4-arch-extra-repository)
|
||||
* [**5 - PowerShell Installer (Multi-Platform)**](#option-5-powershell-installer)
|
||||
* [**6 - Ad Hoc Curl Download**](#option-6-ad-hoc-curl-download)
|
||||
* [**7 - Install Script**](#option-7-install-script)
|
||||
* [**8 - Use Fontfallback**](#option-8-font-fallback)
|
||||
* [**9 - Clone Repo**](#option-9-clone-the-repo)
|
||||
* [**10 - Patch Your Own Font**](#option-10-patch-your-own-font)
|
||||
* [**2 - Homebrew Fonts (macOS/Linux)**](#option-2-homebrew-fonts)
|
||||
* [**3 - Install Script**](#option-3-install-script)
|
||||
* [**4 - Chocolatey or Scoop (Windows)**](#option-4-unofficial-chocolatey-or-scoop-repositories)
|
||||
* [**5 - Arch Linux Repository (Extra, AUR)**](#option-5-arch-extra-repository)
|
||||
* [**6 - PowerShell Installer (Multi-Platform)**](#option-6-powershell-installer)
|
||||
* [**7 - Use Fontfallback**](#option-7-font-fallback)
|
||||
* [**8 - Clone Repo**](#option-8-clone-the-repo)
|
||||
* [**9 - Patch Your Own Font**](#option-9-patch-your-own-font)
|
||||
|
||||
[**Features**](#features)
|
||||
* [**Glyph/Icon sets**](#glyph-sets)
|
||||
|
|
@ -78,15 +77,14 @@ The following flow diagram shows the current glyph sets included:
|
|||
_If you..._
|
||||
|
||||
* `Option 1.` want to download a **font family** package of variations (bold, italic, etc.) see [download an archive](#option-1-release-archive-download)
|
||||
* `Option 2.` are on **macOS** and want to use **Homebrew** see [Homebrew Fonts](#option-2-homebrew-fonts)
|
||||
* `Option 3.` are on **Windows** and want to use **Chocolatey** or **Scoop** see [Unofficial Chocolatey or Scoop Repositories](#option-3-unofficial-chocolatey-or-scoop-repositories)
|
||||
* `Option 4.` are on **Arch Linux** and want to use **Extra packages** see [Arch Extra Repositories](#option-4-arch-extra-repository)
|
||||
* `Option 5.` are using **PowerShell** and want an **interactive setup** or **use in scripts** see the [PowerShell Installer](#option-5-powershell-installer)
|
||||
* `Option 6.` want to use the **`curl` command** or use in **scripts** see [Ad Hoc Curl Download](#option-6-ad-hoc-curl-download)
|
||||
* `Option 7.` want to **automate** installing or use in **scripts** see the [Install Script](#option-7-install-script)
|
||||
* `Option 8.` want to install only one font for all fonts see [Font Fallback](#option-8-font-fallback)
|
||||
* `Option 9.` want **complete control** then see [cloning the repo](#option-9-clone-the-repo)
|
||||
* `Option 10.` want to patch your own font see the [Font Patcher](#option-10-patch-your-own-font)
|
||||
* `Option 2.` are on **macOS** or **Linux** and want to use **Homebrew** see [Homebrew Fonts](#option-2-homebrew-fonts)
|
||||
* `Option 3.` want to **automate** installing or use in **scripts** see the [Install Script](#option-3-install-script)
|
||||
* `Option 4.` are on **Windows** and want to use **Chocolatey** or **Scoop** see [Unofficial Chocolatey or Scoop Repositories](#option-4-unofficial-chocolatey-or-scoop-repositories)
|
||||
* `Option 5.` are on **Arch Linux** and want to use **Extra packages** see [Arch Extra Repositories](#option-5-arch-extra-repository)
|
||||
* `Option 6.` are using **PowerShell** and want an **interactive setup** or **use in scripts** see the [PowerShell Installer](#option-6-powershell-installer)
|
||||
* `Option 7.` want to install only one font for all fonts see [Font Fallback](#option-7-font-fallback)
|
||||
* `Option 8.` want **complete control** then see [cloning the repo](#option-8-clone-the-repo)
|
||||
* `Option 9.` want to patch your own font see the [Font Patcher](#option-9-patch-your-own-font)
|
||||
|
||||
## Features
|
||||
* A [FontForge Python script](#font-patcher) to patch any font
|
||||
|
|
@ -228,9 +226,9 @@ curl -OL https://github.com/ryanoasis/nerd-fonts/releases/latest/download/JetBra
|
|||
|
||||
### `Option 2: Homebrew Fonts`
|
||||
|
||||
> Best option if on **macOS** and want to use **Homebrew**.
|
||||
> Best option if you want to use **Homebrew**.
|
||||
|
||||
All fonts are available via [Homebrew Cask](https://github.com/Homebrew/homebrew-cask) on macOS (OS X)
|
||||
All fonts are available via [Homebrew Cask](https://github.com/Homebrew/homebrew-cask) on macOS or Linux
|
||||
|
||||
```sh
|
||||
brew install font-hack-nerd-font
|
||||
|
|
@ -238,7 +236,41 @@ brew install font-hack-nerd-font
|
|||
|
||||
_On Linux you have to add `--cask` after `install`._
|
||||
|
||||
### `Option 3: Unofficial Chocolatey or Scoop Repositories`
|
||||
### `Option 3: Install Script`
|
||||
|
||||
To install fonts from [(latest) release](https://github.com/ryanoasis/nerd-fonts/releases/latest)
|
||||
use this script.
|
||||
|
||||
> Best option if you want to **automate** installing or for use in **scripts**.
|
||||
|
||||
Only available for Linux / MacOS. It downloads the release artifacts of the latest or any
|
||||
other release and installs the files.
|
||||
|
||||
If you install all patched Fonts: _Warning: This is a lot of Fonts adding up to a large size_
|
||||
|
||||
The script is a standalone tool that you can download individually, use like the following.
|
||||
No need to clone the complete repository (which does not contain all patched fonts anyhow).
|
||||
|
||||
```sh
|
||||
curl -s https://raw.githubusercontent.com/ryanoasis/nerd-fonts/master/install.sh -o install.sh
|
||||
chmod u+x install.sh
|
||||
./install.sh --help
|
||||
```
|
||||
|
||||
Examples:
|
||||
|
||||
```sh
|
||||
./install.sh list
|
||||
./install.sh install <FontName>
|
||||
./install.sh install Hack
|
||||
./install.sh install HeavyData
|
||||
./install.sh install all
|
||||
./install.sh install # interactive mode
|
||||
VERBOSE=3 ./install.sh install DaddyTimeMono
|
||||
GH_RELEASE_TAG=v3.2.1 ./install.sh list
|
||||
```
|
||||
|
||||
### `Option 4: Unofficial Chocolatey or Scoop Repositories`
|
||||
|
||||
> Option for **Windows** and wanting to use **Chocolatey** or **Scoop**.
|
||||
|
||||
|
|
@ -255,14 +287,14 @@ scoop bucket add nerd-fonts
|
|||
scoop install Hack-NF
|
||||
```
|
||||
|
||||
### `Option 4: Arch Extra Repository`
|
||||
### `Option 5: Arch Extra Repository`
|
||||
|
||||
> Option for **Arch Linux** and wanting to use **Extra packages**.
|
||||
|
||||
Most fonts are available via [Arch Extra packages](https://archlinux.org/groups/any/nerd-fonts/).
|
||||
Some special packages are [in AUR](https://aur.archlinux.org/packages?K=nerd-fonts-&outdated=off).
|
||||
|
||||
### `Option 5: PowerShell Installer`
|
||||
### `Option 6: PowerShell Installer`
|
||||
|
||||
> Best option for **interactive setup guidance** or **automating** installations through **PowerShell scripts**.
|
||||
|
||||
|
|
@ -302,70 +334,7 @@ To install specific fonts directly, use the following command:
|
|||
& ([scriptblock]::Create((iwr 'https://to.loredo.me/Install-NerdFont.ps1'))) -Name hack, heavy-data
|
||||
```
|
||||
|
||||
### `Option 6: Ad Hoc Curl Download`
|
||||
|
||||
> Option if you want to use the **`curl` command** or for use in **scripts**.
|
||||
|
||||
_Note_: Will not work to get newer fonts as they are not inside the repo anymore.
|
||||
|
||||
#### Linux
|
||||
|
||||
```sh
|
||||
mkdir -p ~/.local/share/fonts
|
||||
cd ~/.local/share/fonts && curl -fLO https://github.com/ryanoasis/nerd-fonts/raw/HEAD/patched-fonts/DroidSansMono/DroidSansMNerdFont-Regular.otf
|
||||
```
|
||||
|
||||
_Note:_ deprecated alternative paths: `~/.fonts`
|
||||
|
||||
#### macOS (OS X)
|
||||
|
||||
```sh
|
||||
cd ~/Library/Fonts && curl -fLO https://github.com/ryanoasis/nerd-fonts/raw/HEAD/patched-fonts/DroidSansMono/DroidSansMNerdFont-Regular.otf
|
||||
```
|
||||
|
||||
### `Option 7: Install Script`
|
||||
|
||||
> Best option if you want to **automate** installing or for use in **scripts**.
|
||||
|
||||
_Note_:
|
||||
- **Requires (shallow) cloning** the repo as of now :-(
|
||||
- Will not work to get newer fonts as they are not inside the repo anymore.
|
||||
|
||||
#### All fonts:
|
||||
|
||||
* Installs all the patched Fonts (_Warning: This is a lot of Fonts adding up to a large size_)
|
||||
|
||||
```sh
|
||||
./install.sh
|
||||
```
|
||||
|
||||
or, in PowerShell (Windows only):
|
||||
|
||||
```powershell
|
||||
./install.ps1
|
||||
```
|
||||
|
||||
#### Single font:
|
||||
|
||||
* Installs a single Font of your choice
|
||||
|
||||
```sh
|
||||
./install.sh <FontName>
|
||||
./install.sh Hack
|
||||
./install.sh HeavyData
|
||||
```
|
||||
|
||||
or, in PowerShell (Windows only):
|
||||
|
||||
```powershell
|
||||
./install.ps1 <FontName>
|
||||
./install.ps1 Hack
|
||||
./install.ps1 HeavyData
|
||||
./install.ps1 FiraCode, Hack
|
||||
./install.ps1 DejaVuSansMono -WhatIf
|
||||
```
|
||||
|
||||
### `Option 8: Font Fallback`
|
||||
### `Option 7: Font Fallback`
|
||||
Most systems have a mechanism to search for an alternative font when the current font does not
|
||||
have a glyph that is needed. For example you edit a Latin text and insert a Chinese character,
|
||||
that glyph is taken not from your active font (it does not have it) but from some other font.
|
||||
|
|
@ -378,7 +347,7 @@ For fontconfig based systems like Linux you can improve the behavior with the
|
|||
* Pro: One symbol font is sufficient for all text fonts
|
||||
* Con: Scaling and placement of the fallback symbols can be hit or miss
|
||||
|
||||
### `Option 9: Clone the Repo`
|
||||
### `Option 8: Clone the Repo`
|
||||
|
||||
> Best option for **full control**, **all** or **some** of the fonts, or **contributing** to development.
|
||||
|
||||
|
|
@ -405,7 +374,7 @@ cd nerd-fonts
|
|||
git sparse-checkout add patched-fonts/JetBrainsMono
|
||||
```
|
||||
|
||||
### `Option 10: Patch Your Own Font`
|
||||
### `Option 9: Patch Your Own Font`
|
||||
|
||||
> The option for **patching** your **own font** or fully **customizing** the patched font.
|
||||
|
||||
|
|
@ -801,7 +770,7 @@ Font repos
|
|||
[f-mononoki]:https://madmalik.github.io/mononoki
|
||||
[f-mplus]:https://mplusfonts.github.io
|
||||
[f-noto]:https://fonts.google.com/noto
|
||||
[f-opendyslexic]:https://github.com/antijingoist/open-dyslexic
|
||||
[f-opendyslexic]:https://opendyslexic.org
|
||||
[f-overpass]:http://overpassfont.org
|
||||
[f-profont]:https://tobiasjung.name/profont
|
||||
[f-recursive]:https://github.com/arrowtype/recursive
|
||||
|
|
|
|||
|
|
@ -2,12 +2,10 @@
|
|||
|
||||
**OpenDyslexic**, a typeface that uses typeface shapes & features to help offset some visual symptoms of Dyslexia.
|
||||
|
||||
https://opendyslexic.org/
|
||||
|
||||
For more information have a look at the upstream website: https://github.com/antijingoist/opendyslexic
|
||||
For more information have a look at the upstream website: https://opendyslexic.org
|
||||
|
||||
'Alta' has a closed small letter a, while 'Regular' has the open form.
|
||||
|
||||
The `ldot` ligatures are removed because they map to only one advance width.
|
||||
|
||||
Version: 2.001
|
||||
Version: 2.001 (Mono 1.001)
|
||||
|
|
|
|||
Loading…
Reference in a new issue