Skip to content

Commit

Permalink
feat: initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanccn committed Feb 15, 2024
0 parents commit 991ce6a
Show file tree
Hide file tree
Showing 7 changed files with 368 additions and 0 deletions.
50 changes: 50 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Publish

on:
check_suite:
types: [completed]

concurrency:
group: publish-${{ github.ref }}
cancel-in-progress: true

permissions:
contents: write

jobs:
publish:
runs-on: ubuntu-latest

strategy:
matrix:
package:
- ryan-mono
- ryan-term
- ryan-mono-nerd
- ryan-term-nerd

steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install Nix
uses: cachix/install-nix-action@v22

- name: Build flake
run: |
nix build --accept-flake-config -L .#${{ matrix.package }}
- name: Package fonts
run: |
zip -r ${{ github.workspace }}/${{ matrix.package }}.zip *
working-directory: result

- name: Get current date
id: date
run: echo "date=$(date +'%Y.%m.%d')" >> "$GITHUB_OUTPUT"

- name: Release
uses: softprops/action-gh-release@v1
with:
name: v${{ steps.date.outputs.date }}
tag_name: ${{ steps.date.outputs.date }}
files: ${{ matrix.package }}.zip
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.DS_Store

.vscode/
.idea/

work/
dist/
100 changes: 100 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
Copyright (c) 2024, Ryan Cao ([email protected])

Copyright (c) 2015-2024, Renzhi Li (aka. Belleve Invis, [email protected])

This Font Software is licensed under the SIL Open Font License, Version 1.1.

This license is copied below, and is also available with a FAQ at:
http://scripts.sil.org/OFL

---

# SIL Open Font License v1.1

## Preamble

The goals of the Open Font License (OFL) are to stimulate worldwide
development of collaborative font projects, to support the font creation
efforts of academic and linguistic communities, and to provide a free and
open framework in which fonts may be shared and improved in partnership
with others.

The OFL allows the licensed fonts to be used, studied, modified and
redistributed freely as long as they are not sold by themselves. The
fonts, including any derivative works, can be bundled, embedded,
redistributed and/or sold with any software provided that any reserved
names are not used by derivative works. The fonts and derivatives,
however, cannot be released under any other type of license. The
requirement for fonts to remain under this license does not apply
to any document created using the fonts or their derivatives.

## Definitions

`"Font Software"` refers to the set of files released by the Copyright
Holder(s) under this license and clearly marked as such. This may
include source files, build scripts and documentation.

`"Reserved Font Name"` refers to any names specified as such after the
copyright statement(s).

`"Original Version"` refers to the collection of Font Software components as
distributed by the Copyright Holder(s).

`"Modified Version"` refers to any derivative made by adding to, deleting,
or substituting -- in part or in whole -- any of the components of the
Original Version, by changing formats or by porting the Font Software to a
new environment.

`"Author"` refers to any designer, engineer, programmer, technical
writer or other person who contributed to the Font Software.

## Permission & Conditions

Permission is hereby granted, free of charge, to any person obtaining
a copy of the Font Software, to use, study, copy, merge, embed, modify,
redistribute, and sell modified and unmodified copies of the Font
Software, subject to the following conditions:

1. Neither the Font Software nor any of its individual components,
in Original or Modified Versions, may be sold by itself.

2. Original or Modified Versions of the Font Software may be bundled,
redistributed and/or sold with any software, provided that each copy
contains the above copyright notice and this license. These can be
included either as stand-alone text files, human-readable headers or
in the appropriate machine-readable metadata fields within text or
binary files as long as those fields can be easily viewed by the user.

3. No Modified Version of the Font Software may use the Reserved Font
Name(s) unless explicit written permission is granted by the corresponding
Copyright Holder. This restriction only applies to the primary font name as
presented to the users.

4. The name(s) of the Copyright Holder(s) or the Author(s) of the Font
Software shall not be used to promote, endorse or advertise any
Modified Version, except to acknowledge the contribution(s) of the
Copyright Holder(s) and the Author(s) or with their explicit written
permission.

5. The Font Software, modified or unmodified, in part or in whole,
must be distributed entirely under this license, and must not be
distributed under any other license. The requirement for fonts to
remain under this license does not apply to any document created
using the Font Software.

## Termination

This license becomes null and void if any of the above conditions are
not met.

DISCLAIMER

THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
OTHER DEALINGS IN THE FONT SOFTWARE.
61 changes: 61 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# Ryan Mono

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.

## Install

Fonts are built as TTFs and packaged in four 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

### Non-Nerd Font

| | 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] |

### Nerd Font

| | Ryan Mono | Ryan Term |
| -------- | -------------------------------------------------- | -------------------------------------------------- |
| `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] |

## 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.

```console
$ ./build.sh
```

The script automatically downloads sources for Iosevka and Nerd Fonts, builds and patches fonts, and packages them, along with managing concurrency.

## License

SIL Open Font License, Version 1.1

[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
14 changes: 14 additions & 0 deletions RyanMono.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[buildPlans.RyanMono]
family = "Ryan Mono"
spacing = "normal"
serifs = "sans"
noCvSs = true
exportGlyphNames = true

[buildPlans.RyanMono.variants]
inherits = "ss05"

[buildPlans.RyanMono.widths.Normal]
shape = 600
menu = 5
css = "normal"
14 changes: 14 additions & 0 deletions RyanTerm.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[buildPlans.RyanTerm]
family = "Ryan Term"
spacing = "term"
serifs = "sans"
noCvSs = true
exportGlyphNames = true

[buildPlans.RyanTerm.variants]
inherits = "ss05"

[buildPlans.RyanTerm.widths.Normal]
shape = 600
menu = 5
css = "normal"
122 changes: 122 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
#!/bin/bash
# shellcheck disable=SC2005,SC2120
set -eo pipefail

pushd() {
command pushd "$@" > /dev/null
}

popd() {
command popd "$@" > /dev/null
}

bold() {
printf '\033[1m%s\033[22m' "$@"
}

dim() {
printf '\033[2m%s\033[22m' "$@"
}

red() {
printf '\033[31m%s\033[39m' "$@"
}

green() {
printf '\033[32m%s\033[39m' "$@"
}

cyan() {
printf '\033[36m%s\033[39m' "$@"
}

iosevka_version="v28.1.0"
nerd_fonts_version="v3.1.1"
font_families=("RyanMono" "RyanTerm")

check_dependencies() {
for dep in "$@"; do
if ! command -v "$dep" &> /dev/null; then
echo "$(red "Error: $(bold "$dep") is required for building ryan-mono!")"
exit 1
fi
done
}

check_dependencies \
printf echo rm mkdir git \
node npm find xargs curl \
unzip date zip tar cp

echo "$(bold "ryan-mono $(date +%Y.%m.%d)")"

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"
command -v sysctl &> /dev/null && cpus="$(sysctl -n hw.physicalcpu)" && cpus_source="sysctl"

echo -e "$(cyan "Concurrency")\t$cpus $(dim "($cpus_source)")"
echo

rm -rf dist

for font_family in "${font_families[@]}"; do
echo "$(green "$(bold "Building $font_family")")"

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

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

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

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

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

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/dist-nerd

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 ./*

popd

rm -rf work
done

0 comments on commit 991ce6a

Please sign in to comment.