Skip to content

Commit

Permalink
nerd fonts patching
Browse files Browse the repository at this point in the history
  • Loading branch information
molarmanful committed Mar 30, 2024
1 parent 7b8a312 commit 480121a
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pub.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
- name: build
env:
REF: ${{ github.ref_name }}
run: ./build.sh -v "$REF"
run: ./build.sh -v "$REF" -n
- name: Release
uses: svenstaro/[email protected]
with:
Expand Down
15 changes: 11 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ VSCode), then use the TTF at font sizes that are multiples of 16px.
>
> e.g. 13px on a 96dpi screen is `16px * 72 / 96dpi = 12pt`.
Patched Nerd Fonts are available. The "Mono" variant uses smaller glyphs
(single- instead of double-width) and works for terminals that can't mix
widths.

### Manually Building

Requirements:
Expand All @@ -88,10 +92,13 @@ Optional:

`git clone` and run `build.sh`. Font files output to `out/`.

`build.sh` downloads FontForge as an AppImage at `deps/` for generating bitmap
formats from BDF. `build.sh` also downloads a Bits'n'Picas binary at `deps/`.
If you wish, you can use this binary (instead of or alongside FontForge) to
view glyphs and build desired font formats not found on the Releases page.
`build.sh` downloads into `deps/`:

- A FontForge AppImage for generating bitmap formats from BDF.
- A Bits'n'Picas binary. If you wish, you can use this binary
(instead of or alongside FontForge) to view glyphs and build desired font
formats not found on the Releases page.
- A Nerd Fonts Patcher, which requires `-n` to activate.

`hb-view` is necessary if you wish to use
`img.sh` to generate the images found in `img/`, but is otherwise unused in the
Expand Down
14 changes: 13 additions & 1 deletion build.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
#!/bin/bash -e

while getopts ":v:" o; do
while getopts "v:n" o; do
case $o in
v)
if [ "$OPTARG" != "" ]; then
v=$OPTARG
fi
;;
n)
n=1
;;
*) ;;
esac
done
Expand All @@ -16,6 +19,7 @@ mkdir -p deps out

[ ! -f deps/BitsNPicas.jar ] && wget -O deps/BitsNPicas.jar https://github.com/kreativekorp/bitsnpicas/releases/latest/download/BitsNPicas.jar
[ ! -f deps/fontforge ] && wget -O deps/fontforge https://github.com/fontforge/fontforge/releases/download/20230101/FontForge-2023-01-01-a1dad3e-x86_64.AppImage && chmod +x deps/fontforge
[ ! -f deps/font-patcher ] && wget -O deps/FontPatcher.zip https://github.com/ryanoasis/nerd-fonts/releases/latest/download/FontPatcher.zip && unzip deps/FontPatcher.zip -d deps && chmod +x deps/font-patcher

cp LICENSE out
cp README.md out
Expand Down Expand Up @@ -46,7 +50,15 @@ pcf() {
fi
}

nerd() {
if [ "$n" != "" ]; then
deps/fontforge -script "$PWD"/deps/font-patcher "$PWD"/out/kirsch.ttf -out "$PWD"/out --careful -c "$@"
fi
}

bnp src/kirsch.kbitx kirsch ttf
nerd
nerd -s
bnp src/kirsch.kbitx kirsch bdf
sed -i -e '/^FONT/s/-[pc]-/-M-/i' -e '/^FONT/s/-80-/-50-/' out/kirsch.bdf
ff kirsch
Expand Down

0 comments on commit 480121a

Please sign in to comment.