about summary refs log tree commit diff
path: root/pkgs/data/fonts/iosevka
diff options
context:
space:
mode:
authorDamien Cassou <damien@cassou.me>2022-07-14 20:21:41 +0200
committerGitHub <noreply@github.com>2022-07-14 20:21:41 +0200
commit28fe657e1f16bd2df112ba414a6fcdad8215fc01 (patch)
tree76e33925181f3aa011077ec3103e786d8b6d2c2e /pkgs/data/fonts/iosevka
parentfd00fef45d09d26c708e941bc76d85a09af44a98 (diff)
parentbae6a92d4feb2bef4aa6a3da9097199d1d6897a1 (diff)
Merge pull request #179839 from DamienCassou/update-iosevka-comfy
Diffstat (limited to 'pkgs/data/fonts/iosevka')
-rw-r--r--pkgs/data/fonts/iosevka/comfy-private-build-plans.toml34
-rw-r--r--pkgs/data/fonts/iosevka/comfy.nix9
-rwxr-xr-xpkgs/data/fonts/iosevka/update-comfy.sh33
3 files changed, 67 insertions, 9 deletions
diff --git a/pkgs/data/fonts/iosevka/comfy-private-build-plans.toml b/pkgs/data/fonts/iosevka/comfy-private-build-plans.toml
index d5b0221a64aa5..1affc3a8c84d8 100644
--- a/pkgs/data/fonts/iosevka/comfy-private-build-plans.toml
+++ b/pkgs/data/fonts/iosevka/comfy-private-build-plans.toml
@@ -1,5 +1,5 @@
 # The file below is copy/pasted from
-# https://github.com/protesilaos/iosevka-comfy/blob/0.1.0/private-build-plans.toml. It
+# https://raw.githubusercontent.com/protesilaos/iosevka-comfy/0.2.1/private-build-plans.toml. It
 # seems like ofborg will prevent me from using fetchurl to download
 # this file automatically.
 [buildPlans.iosevka-comfy]       # <iosevka-comfy> is your plan name
@@ -303,9 +303,19 @@ serifs = "sans"
 [buildPlans.iosevka-comfy-duo.variants]
 inherits = "buildPlans.iosevka-comfy"
 
-# The short middle leg in 'm' that we need in the narrow monospaced
-# variants is necessary for legibility, especially at small point sizes.
-# Otherwise it is a gimmick, so we remove it in the "wider" builds.
+# The '0' has a forward slash that cuts diagonally through the middle of
+# the circle, connecting the bottom left part to the top right of the
+# oval shape.  Whereas the narrow variants have a dashed forward slash
+# which does not connect the two sides as it is positioned inside the
+# oval shape.
+[buildPlans.iosevka-comfy-duo.variants.design]
+cv71 = 9    # 0 oval forward slash
+
+# The 'm' character has three legs of equal length, insetad of a shorter
+# middle leg.  The short middle leg in the narrow variants is necessary
+# for legibility, especially at small point sizes (otherwise the
+# character's legs visually blend into what appears to be a solid
+# block).
 [buildPlans.iosevka-comfy-duo.variants.upright]
 cv38 = 5    # m earless normal middle leg
 
@@ -371,9 +381,19 @@ serifs = "sans"
 [buildPlans.iosevka-comfy-wide.variants]
 inherits = "buildPlans.iosevka-comfy"
 
-# The short middle leg in 'm' that we need in the narrow monospaced
-# variants is necessary for legibility, especially at small point sizes.
-# Otherwise it is a gimmick, so we remove it in the "wider" builds.
+# The '0' has a forward slash that cuts diagonally through the middle of
+# the circle, connecting the bottom left part to the top right of the
+# oval shape.  Whereas the narrow variants have a dashed forward slash
+# which does not connect the two sides as it is positioned inside the
+# oval shape.
+[buildPlans.iosevka-comfy-wide.variants.design]
+cv71 = 9    # 0 oval forward slash
+
+# The 'm' character has three legs of equal length, insetad of a shorter
+# middle leg.  The short middle leg in the narrow variants is necessary
+# for legibility, especially at small point sizes (otherwise the
+# character's legs visually blend into what appears to be a solid
+# block).
 [buildPlans.iosevka-comfy-wide.variants.upright]
 cv38 = 5    # m earless normal middle leg
 
diff --git a/pkgs/data/fonts/iosevka/comfy.nix b/pkgs/data/fonts/iosevka/comfy.nix
index 9cc2ecfb63686..3e42151857f16 100644
--- a/pkgs/data/fonts/iosevka/comfy.nix
+++ b/pkgs/data/fonts/iosevka/comfy.nix
@@ -1,10 +1,15 @@
 {stdenv, lib, nodejs, nodePackages, remarshal, ttfautohint-nox, fetchurl}:
 
 let
-  sets = [ "comfy" "comfy-duo" "comfy-wide" "comfy-wide-fixed"];
+  sets = [ "comfy" "comfy-fixed" "comfy-duo" "comfy-wide" "comfy-wide-fixed" ];
   privateBuildPlan = builtins.readFile ./comfy-private-build-plans.toml;
   overrideAttrs = (attrs: {
-    version = "0.1.0";
+    version = "0.2.1";
+
+    passthru = {
+      updateScript = ./update-comfy.sh;
+    };
+
     meta = with lib; {
       homepage = "https://github.com/protesilaos/iosevka-comfy";
       description = ''
diff --git a/pkgs/data/fonts/iosevka/update-comfy.sh b/pkgs/data/fonts/iosevka/update-comfy.sh
new file mode 100755
index 0000000000000..63e68c768dd95
--- /dev/null
+++ b/pkgs/data/fonts/iosevka/update-comfy.sh
@@ -0,0 +1,33 @@
+#! /usr/bin/env nix-shell
+#! nix-shell -i bash -p curl jq
+
+set -euo pipefail
+cd "$(dirname "${BASH_SOURCE[0]}")"
+
+repo=protesilaos/iosevka-comfy
+oldVersion=$(nix-instantiate --eval -E 'with import ../../../.. {}; lib.getVersion iosevka-comfy.comfy' | tr -d \")
+version=$(curl -s https://api.github.com/repos/$repo/tags | jq '.[0].name' | tr -d \")
+buildPlansUrl=https://raw.githubusercontent.com/$repo/$(echo $version)/private-build-plans.toml
+
+if test "$oldVersion" = "$version"; then
+    echo "New version same as old version, nothing to do." >&2
+    exit 0
+fi
+
+sed --in-place "s/$oldVersion/$version/" comfy.nix
+
+cat  > ./comfy-private-build-plans.toml <<EOF
+# The file below is copy/pasted from
+# $buildPlansUrl. It
+# seems like ofborg will prevent me from using fetchurl to download
+# this file automatically.
+EOF
+
+wget --quiet --output-document=- "$buildPlansUrl" >> ./comfy-private-build-plans.toml
+
+sets=$(grep '^\[buildPlans\.iosevka-comfy[^.]*\]' comfy-private-build-plans.toml \
+           | sed 's/^.*iosevka-\(comfy[^]]*\)].*$/"\1" /' \
+           | tr -d '\n' \
+           | sort)
+
+sed --in-place "s/sets = .*$/sets = [ $sets];/" comfy.nix