Skip to content

Latest commit

 

History

History
149 lines (97 loc) · 3.03 KB

Nerd Fonts.md

File metadata and controls

149 lines (97 loc) · 3.03 KB

Nerd Fonts

Setup

Install Docker.

Create a working directory with a fonts subdirectory.

mkdir -p ~/nerdfonts/fonts

Copy fonts to be patched into ~/nerdfonts/fonts.

Run Docker from the working directory.

docker run -it --name font-patcher -v "$(pwd):/work" -w /work ubuntu:latest /bin/bash

Update apt-get.

apt-get update

Install necessary packages.

apt-get install -y fontforge python3 python3-pip wget unzip git python3-fontforge

Get the font patcher from GitHub.

wget https://github.com/ryanoasis/nerd-fonts/releases/latest/download/FontPatcher.zip
unzip FontPatcher.zip

Make the font patcher executable.

chmod +x font-patcher

Update the font patcher to use Python 3.

sed -i '1s/python/python3/' font-patcher

Exit the Docker container.

exit

Use the container again at any time.

docker start -ai font-patcher

Patching

Run the font patcher for each font file in ./fonts.

for file in ./fonts/*.ttf; do ./font-patcher -c "$file"; done

Patch Mono variants.

for file in ./fonts/*.ttf; do ./font-patcher -c -s "$file"; done

Patch Propo variants.

for file in ./fonts/*.ttf; do ./font-patcher -c --variable-width-glyphs "$file"; done

Symbols Nerd Font

Get Symbols Custom.sfd from Dotfiles with wget.

wget -P ~/nerdfonts/fonts https://raw.githubusercontent.com/lukejanicke/dotfiles/main/nerdfonts/Symbols\ Custom.sfd

Patch Symbols Nerd Font.

./font-patcher -c --ext ttf fonts/Symbols\ Custom.sfd

Patch Symbols Nerd Font Mono.

./font-patcher -c -s --ext ttf fonts/Symbols\ Custom.sfd

Make sure the actual Symbols Nerd Font is renamed or moved to a safe location.

Patch Symbols Nerd Font Propo (manually appending Propo to the patched file).

./font-patcher -c --variable-width-glyphs --ext ttf fonts/Symbols\ Custom.sfd

[!bug] Symbol Nerd Font Propo --variable-width-glyphs builds a Propo font but names it Symbols Nerd Font, which conflicts with the real Symbols Nerd Font. See Symbols Nerd Font Propo for renaming the font using fonttools.

Symbols Nerd Font Propo

Install fonttools with pip.

pip install fonttools

Decompile Symbols Nerd Font Propo.ttf to XML.

ttx SymbolsCustom\ Nerd\ Font\ Propo\ Regular.ttf

Edit Symbols Nerd Font Propo.ttx.

code SymbolsCustom\ Nerd\ Font\ Propo\ Regular.ttx

Replace six instances of SymbolsCustom Nerd Font with SymbolsCustom Nerd Font Propo.

Replace two instances of SymbolsCustomNF with SymbolsCustomNFP.

Recompile Symbols Nerd Font Propo.ttf (delete or rename the original).

ttx SymbolsCustom\ Nerd\ Font\ Propo\ Regular.ttx