diff --git a/RyanMono.toml b/RyanMono.toml index 41570dd..00b21d1 100644 --- a/RyanMono.toml +++ b/RyanMono.toml @@ -1,8 +1,8 @@ [buildPlans.RyanMono] -family = "Ryan Mono" -spacing = "normal" -serifs = "sans" -noCvSs = false +family = "Ryan Mono" +spacing = "normal" +serifs = "sans" +noCvSs = false exportGlyphNames = true [buildPlans.RyanMono.variants] @@ -10,5 +10,16 @@ inherits = "ss05" [buildPlans.RyanMono.widths.Normal] shape = 600 -menu = 5 -css = "normal" +menu = 5 +css = "normal" + +[buildPlans.RyanMono.namingOverride] +version = "%%version%%" +copyright = "Copyright 2015-{{currentYear}}, Renzhi Li (aka. Belleve Invis, belleve@typeof.net). Copyright 2024-{{currentYear}}, Ryan Cao (hello@ryanccn.dev)." +manufacturer = "Ryan Cao" +designer = "Belleve Invis" +description = "Ryan's homemade Iosevka build." +urlVendor = "https://github.com/ryanccn/ryan-mono" +urlDesigner = "https://typeof.net/Iosevka/" +licence = "This font software is licenced under the SIL Open Font Licence, Version 1.1. This licence is available with a FAQ at: http://scripts.sil.org/OFL. This font software is distributed on an 'AS IS' basis, without warranties or conditions of any kind, either express or implied. See the SIL Open Font licence for the specific language, permissions and limitations governing your use of this font software." +licenceURL = "https://openfontlicense.org/" diff --git a/RyanTerm.toml b/RyanTerm.toml index 491c3f0..cac9248 100644 --- a/RyanTerm.toml +++ b/RyanTerm.toml @@ -1,8 +1,8 @@ [buildPlans.RyanTerm] -family = "Ryan Term" -spacing = "term" -serifs = "sans" -noCvSs = false +family = "Ryan Term" +spacing = "term" +serifs = "sans" +noCvSs = false exportGlyphNames = true [buildPlans.RyanTerm.variants] @@ -10,5 +10,16 @@ inherits = "ss05" [buildPlans.RyanTerm.widths.Normal] shape = 600 -menu = 5 -css = "normal" +menu = 5 +css = "normal" + +[buildPlans.RyanTerm.namingOverride] +version = "%%version%%" +copyright = "Copyright 2015-{{currentYear}}, Renzhi Li (aka. Belleve Invis, belleve@typeof.net). Copyright 2024-{{currentYear}}, Ryan Cao (hello@ryanccn.dev)." +manufacturer = "Ryan Cao" +designer = "Belleve Invis" +description = "Ryan's homemade Iosevka build." +urlVendor = "https://github.com/ryanccn/ryan-mono" +urlDesigner = "https://typeof.net/Iosevka/" +licence = "This font software is licenced under the SIL Open Font Licence, Version 1.1. This licence is available with a FAQ at: http://scripts.sil.org/OFL. This font software is distributed on an 'AS IS' basis, without warranties or conditions of any kind, either express or implied. See the SIL Open Font licence for the specific language, permissions and limitations governing your use of this font software." +licenceURL = "https://openfontlicense.org/" diff --git a/build.sh b/build.sh index 51c459a..21aab0b 100755 --- a/build.sh +++ b/build.sh @@ -30,8 +30,8 @@ cyan() { printf '\033[36m%s\033[39m' "$@" } -iosevka_version="v29.0.1" -nerd_fonts_version="v3.1.1" +iosevka_version="v29.1.0" +nerd_fonts_version="v3.2.0" font_families=("RyanMono" "RyanTerm") check_dependencies() { @@ -46,9 +46,11 @@ check_dependencies() { check_dependencies \ printf echo rm mkdir git \ node npm find xargs curl \ - unzip date zip tar cp + unzip date zip tar cp sed -echo "$(bold "ryan-mono $(date +%Y.%m.%d)")" +ryan_mono_version=$(date +%Y.%m.%d) + +echo "$(bold "ryan-mono $ryan_mono_version")" echo -e "$(cyan "Iosevka")\t\t$iosevka_version" echo -e "$(cyan "Nerd Fonts")\t$nerd_fonts_version" @@ -62,38 +64,48 @@ command -v sysctl &> /dev/null && cpus="$(sysctl -n hw.physicalcpu)" && cpus_sou echo -e "$(cyan "Concurrency")\t$cpus $(dim "($cpus_source)")" echo -rm -rf dist +# rm -rf dist +rm -rf work && mkdir -p work dist +pushd work # => work/ + +git clone --depth 1 --branch "$iosevka_version" https://github.com/be5invis/Iosevka.git _iosevka + +pushd _iosevka # => work/_iosevka +for patch in ../../patches/*.patch; do + patch_name="$(basename "$patch")" + git apply "$patch" + git add . + git commit -m "apply patch $patch_name" +done + +npm ci + +popd # => work/ + +curl -fsSL -o FontPatcher.zip \ + "https://github.com/ryanoasis/nerd-fonts/releases/download/$nerd_fonts_version/FontPatcher.zip" +unzip FontPatcher.zip -d _fontpatcher +rm FontPatcher.zip 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 # => work/_iosevka + cp "../../$font_family.toml" "private-build-plans.toml" + sed -i "s/%%version%%/$ryan_mono_version/g" "private-build-plans.toml" - pushd _iosevka - npm ci npm run build -- "ttf::$font_family" - popd + popd # => work/ 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 - rm FontPatcher.zip - 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 + cp ../LICENSE "$font_family" + cp ../LICENSE "${font_family}NerdFont" zip -r -9 ../dist/"$font_family.zip" "$font_family"/* tar --gzip -cvf ../dist/"$font_family.tar.gz" "$font_family"/* @@ -102,8 +114,4 @@ for font_family in "${font_families[@]}"; do 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 - - rm -rf work done diff --git a/patches/0001-version.patch b/patches/0001-version.patch new file mode 100644 index 0000000..aa8002d --- /dev/null +++ b/patches/0001-version.patch @@ -0,0 +1,28 @@ +From 36b1c056f544e5b87f835a92e0c97e0adb732f5b Mon Sep 17 00:00:00 2001 +From: Ryan Cao <70191398+ryanccn@users.noreply.github.com> +Date: Sat, 6 Apr 2024 14:14:03 +0800 +Subject: [PATCH] a + +--- + packages/font/src/naming/index.mjs | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/packages/font/src/naming/index.mjs b/packages/font/src/naming/index.mjs +index 161809f..f37bf0f 100644 +--- a/packages/font/src/naming/index.mjs ++++ b/packages/font/src/naming/index.mjs +@@ -132,9 +132,9 @@ function setVersion(font, naming) { + if (naming.version) { + // Trim the "Version " prefix if it exists + const versionString = naming.version.trim().replace(/^Version\s+/i, ""); +- const ver = semver.parse(versionString); ++ const ver = semver.parse(versionString.replace(/\.0+/g, '.')); + if (!ver) throw new Error(`Version string ${naming.version} does not follow semver format`); +- if (ver.minor > 99 || ver.patch > 99) throw new RangeError("Version number overflow"); ++ // if (ver.minor > 99 || ver.patch > 99) throw new RangeError("Version number overflow"); + + // Set Name entry + nameFont(font, Ot.Name.NameID.VersionString, `Version ${versionString}`); +-- +2.44.0 + diff --git a/taplo.toml b/taplo.toml new file mode 100644 index 0000000..ac9464c --- /dev/null +++ b/taplo.toml @@ -0,0 +1,2 @@ +[formatting] +align_entries = true