Skip to content

Commit

Permalink
feat: improve build script and docs
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanccn committed Feb 16, 2024
1 parent 991ce6a commit 7d9a8d0
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 98 deletions.
Binary file added .github/cover.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions .github/cover.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
50 changes: 0 additions & 50 deletions .github/workflows/publish.yml

This file was deleted.

31 changes: 14 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
# Ryan Mono
![Ryan Mono](/.github/cover.svg)

Ryan's homemade Iosevka build. There are two families: **Ryan Mono**, a monospace font, and **Ryan Term**, a fixed-width monospace font optimized for the terminal.
Ryan's homemade [Iosevka][iosevka] build. There are two families: **Ryan Mono**, a monospace font, and **Ryan Term**, a fixed-width monospace font optimized for the terminal.

## Install
Each family also has a version that is patched with Nerd Fonts symbols, although it is recommended to use the normal font with [the symbols-only Nerd Font][NerdFontsSymbolsOnly.tar.xz] as a fallback.

Fonts are built as TTFs and packaged in four archive formats, in order from best to worst compression:
## Download

Fonts are built as TTFs and packaged in three archive formats, in order from best to worst compression:

- `tar.br`: tarballs compressed with Brotli (_nonstandard_)
- `tar.xz`: tarballs compressed with XZ
- `tar.gz`: tarballs compressed with Gzip
- `zip`: zip archives
Expand All @@ -15,23 +16,21 @@ Fonts are built as TTFs and packaged in four archive formats, in order from best

| | Ryan Mono | Ryan Term |
| -------- | ---------------------------------- | ---------------------------------- |
| `zip` | [RyanMono.zip][RyanMono.zip] | [RyanTerm.zip][RyanTerm.zip] |
| `tar.gz` | [RyanMono.tar.gz][RyanMono.tar.gz] | [RyanTerm.tar.gz][RyanTerm.tar.gz] |
| `tar.xz` | [RyanMono.tar.xz][RyanMono.tar.xz] | [RyanTerm.tar.xz][RyanTerm.tar.xz] |
| `tar.br` | [RyanMono.tar.br][RyanMono.tar.br] | [RyanTerm.tar.br][RyanTerm.tar.br] |
| `tar.gz` | [RyanMono.tar.gz][RyanMono.tar.gz] | [RyanTerm.tar.gz][RyanTerm.tar.gz] |
| `zip` | [RyanMono.zip][RyanMono.zip] | [RyanTerm.zip][RyanTerm.zip] |

### Nerd Font

| | Ryan Mono | Ryan Term |
| | RyanMono Nerd Font | RyanTerm Nerd Font |
| -------- | -------------------------------------------------- | -------------------------------------------------- |
| `zip` | [RyanMonoNerdFont.zip][RyanMonoNerdFont.zip] | [RyanTermNerdFont.zip][RyanTermNerdFont.zip] |
| `tar.gz` | [RyanMonoNerdFont.tar.gz][RyanMonoNerdFont.tar.gz] | [RyanTermNerdFont.tar.gz][RyanTermNerdFont.tar.gz] |
| `tar.xz` | [RyanMonoNerdFont.tar.xz][RyanMonoNerdFont.tar.xz] | [RyanTermNerdFont.tar.xz][RyanTermNerdFont.tar.xz] |
| `tar.br` | [RyanMonoNerdFont.tar.br][RyanMonoNerdFont.tar.br] | [RyanTermNerdFont.tar.br][RyanTermNerdFont.tar.br] |
| `tar.gz` | [RyanMonoNerdFont.tar.gz][RyanMonoNerdFont.tar.gz] | [RyanTermNerdFont.tar.gz][RyanTermNerdFont.tar.gz] |
| `zip` | [RyanMonoNerdFont.zip][RyanMonoNerdFont.zip] | [RyanTermNerdFont.zip][RyanTermNerdFont.zip] |

## Building

A comprehensive build script is included in `build.sh`. FontForge, Node.js, Git, find, xargs, curl, unzip, tar, and zip are required dependencies. Brotli is an optional dependency for building tarballs compressed with Brotli.
A comprehensive build script is included in `build.sh`. FontForge, Node.js, Git, find, xargs, curl, unzip, tar, and zip are required dependencies.

```console
$ ./build.sh
Expand All @@ -43,19 +42,17 @@ The script automatically downloads sources for Iosevka and Nerd Fonts, builds an

SIL Open Font License, Version 1.1

[iosevka]: https://typeof.net/Iosevka/
[NerdFontsSymbolsOnly.tar.xz]: https://github.com/ryanoasis/nerd-fonts/releases/latest/download/NerdFontsSymbolsOnly.tar.xz
[RyanMono.zip]: https://github.com/ryanccn/ryan-mono/releases/latest/download/RyanMono.zip
[RyanMono.tar.gz]: https://github.com/ryanccn/ryan-mono/releases/latest/download/RyanMono.tar.gz
[RyanMono.tar.xz]: https://github.com/ryanccn/ryan-mono/releases/latest/download/RyanMono.tar.xz
[RyanMono.tar.br]: https://github.com/ryanccn/ryan-mono/releases/latest/download/RyanMono.tar.br
[RyanMonoNerdFont.zip]: https://github.com/ryanccn/ryan-mono/releases/latest/download/RyanMonoNerdFont.zip
[RyanMonoNerdFont.tar.gz]: https://github.com/ryanccn/ryan-mono/releases/latest/download/RyanMonoNerdFont.tar.gz
[RyanMonoNerdFont.tar.xz]: https://github.com/ryanccn/ryan-mono/releases/latest/download/RyanMonoNerdFont.tar.xz
[RyanMonoNerdFont.tar.br]: https://github.com/ryanccn/ryan-mono/releases/latest/download/RyanMonoNerdFont.tar.br
[RyanTerm.zip]: https://github.com/ryanccn/ryan-mono/releases/latest/download/RyanTerm.zip
[RyanTerm.tar.gz]: https://github.com/ryanccn/ryan-mono/releases/latest/download/RyanTerm.tar.gz
[RyanTerm.tar.xz]: https://github.com/ryanccn/ryan-mono/releases/latest/download/RyanTerm.tar.xz
[RyanTerm.tar.br]: https://github.com/ryanccn/ryan-mono/releases/latest/download/RyanTerm.tar.br
[RyanTermNerdFont.zip]: https://github.com/ryanccn/ryan-mono/releases/latest/download/RyanTermNerdFont.zip
[RyanTermNerdFont.tar.gz]: https://github.com/ryanccn/ryan-mono/releases/latest/download/RyanTermNerdFont.tar.gz
[RyanTermNerdFont.tar.xz]: https://github.com/ryanccn/ryan-mono/releases/latest/download/RyanTermNerdFont.tar.xz
[RyanTermNerdFont.tar.br]: https://github.com/ryanccn/ryan-mono/releases/latest/download/RyanTermNerdFont.tar.br
49 changes: 18 additions & 31 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,6 @@ echo -e "$(cyan "Iosevka")\t\t$iosevka_version"
echo -e "$(cyan "Nerd Fonts")\t$nerd_fonts_version"
echo -e "$(cyan "FontForge")\t$(fontforge -version 2> /dev/null | sed -n 's|fontforge ||p')"

if command -v brotli &> /dev/null;
then echo -e "$(cyan "Brotli")\t\tavailable $(dim "($(command -v brotli))")"
else echo -e "$(cyan "Brotli")\t\tunavailable"
fi

cpus=1
cpus_source="unknown"
command -v nproc &> /dev/null && cpus="$(nproc)" && cpus_source="nproc"
Expand All @@ -72,49 +67,41 @@ rm -rf dist
for font_family in "${font_families[@]}"; do
echo "$(green "$(bold "Building $font_family")")"

rm -rf work
mkdir -p work
rm -rf work && mkdir -p work
pushd work

git clone --depth 1 --branch "$iosevka_version" https://github.com/be5invis/Iosevka.git iosevka
cp "../$font_family.toml" iosevka/private-build-plans.toml
git clone --depth 1 --branch "$iosevka_version" https://github.com/be5invis/Iosevka.git _iosevka
cp "../$font_family.toml" _iosevka/private-build-plans.toml

pushd iosevka
pushd _iosevka
npm ci
npm run build -- "ttf::$font_family"
popd

mkdir -p dist
cp iosevka/dist/"$font_family"/TTF/* dist
mkdir -p "$font_family"
cp _iosevka/dist/"$font_family"/TTF/* "$font_family"

curl -fsSL -o FontPatcher.zip \
"https://github.com/ryanoasis/nerd-fonts/releases/download/$nerd_fonts_version/FontPatcher.zip"
unzip FontPatcher.zip -d FontPatcher
unzip FontPatcher.zip -d _fontpatcher
rm FontPatcher.zip

mkdir -p dist-nerd
find dist -name '*.ttf' -print0 | xargs -0 --max-args=1 --max-procs="$cpus" \
fontforge -script FontPatcher/font-patcher --quiet --complete --outputdir dist-nerd
mkdir -p "${font_family}NerdFont"
find "$font_family" -name '*.ttf' -print0 | xargs -0 --max-args=1 --max-procs="$cpus" \
fontforge -script _fontpatcher/font-patcher --quiet --complete --outputdir "${font_family}NerdFont"

popd
mkdir -p dist

pushd work/dist

zip -r -9 ../../dist/"$font_family".zip ./*
tar --gzip -cf ../../dist/"$font_family".tar.gz ./*
tar --xz -cf ../../dist/"$font_family".tar.xz ./*
command -v brotli &> /dev/null && \
tar --use-compress-program "brotli -Z" -cf ../../dist/"$font_family".tar.br ./*

popd
pushd work

pushd work/dist-nerd
zip -r -9 ../dist/"$font_family.zip" "$font_family"/*
tar --gzip -cvf ../dist/"$font_family.tar.gz" "$font_family"/*
tar --xz -cvf ../dist/"$font_family.tar.xz" "$font_family"/*

zip -r -9 ../../dist/"$font_family"NerdFont.zip ./*
tar --gzip -cf ../../dist/"$font_family"NerdFont.tar.gz ./*
tar --xz -cf ../../dist/"$font_family"NerdFont.tar.xz ./*
command -v brotli &> /dev/null && \
tar --use-compress-program "brotli -Z" -cf ../../dist/"$font_family"NerdFont.tar.br ./*
zip -r -9 ../dist/"${font_family}NerdFont.zip" "${font_family}NerdFont"/*
tar --gzip -cvf ../dist/"${font_family}NerdFont.tar.gz" "${font_family}NerdFont"/*
tar --xz -cvf ../dist/"${font_family}NerdFont.tar.xz" "${font_family}NerdFont"/*

popd

Expand Down

0 comments on commit 7d9a8d0

Please sign in to comment.