Do more work on updating fonts
diff --git a/modules/fonts.nix b/modules/fonts.nix
index 14c51bd..1927bff 100644
--- a/modules/fonts.nix
+++ b/modules/fonts.nix
@@ -5,9 +5,9 @@
roboto-mono
roboto-slab
twitter-color-emoji
- font-awesome
- material-design-icons
+ octicons
powerline-symbols
+ monocraft
nerdfonts-glyphs
];
@@ -15,10 +15,10 @@
enableDefaultFonts = true;
fontconfig.defaultFonts = {
- serif = ["Roboto Slab"];
- sansSerif = ["Roboto" "Symbols Nerd Font"];
- monospace = ["Roboto Mono" "Symbols Nerd Font"];
- emoji = ["Twitter Color Emoji"];
+ serif = ["Roboto Slab" "octicons"];
+ sansSerif = ["Roboto" "octicons"];
+ monospace = ["Liga Roboto Mono" "octicons"];
+ emoji = ["Twitter Color Emoji" "octicons"];
};
};
}
diff --git a/overlays/ligaturize.nix b/overlays/ligaturize.nix
index 49d532c..223a1eb 100644
--- a/overlays/ligaturize.nix
+++ b/overlays/ligaturize.nix
@@ -1,11 +1,12 @@
final: prev: let
lib = prev.lib;
fonts = ["roboto-mono"];
- ligaturizer = prev.fetchFromGithub {
+ ligaturizer = prev.fetchFromGitHub {
owner = "ToxicFrog";
repo = "Ligaturizer";
rev = "v5";
- sha256 = lib.fakeSha256;
+ sha256 = "sha256-sFzoUvA4DB9CVonW/OZWWpwP0R4So6YlAQeqe7HLq50=";
+ fetchSubmodules = true;
};
in
lib.pipe fonts [
@@ -13,15 +14,34 @@
inherit name;
value = prev.${name};
}))
+ builtins.listToAttrs
(builtins.mapAttrs (name: value:
value.overrideAttrs (
prevAttrs: {
- postPatch = prevAttrs.postPatch + ''
- find $out -name "*.ttf" -exec fontforge -lang py -script ligaturize.py {} \;
- find $out -name "*.otf" -exec fontforge -lang py -script ligaturize.py {} \;
- false
- '';
+ outputHash = null;
+ outputHashMode = null;
+ outputHashAlgo = null;
+ nativeBuildInputs = (prevAttrs.nativeBuildInputs or []) ++ [prev.fontforge];
+ postFixup =
+ (prevAttrs.postFixup or "")
+ + ''
+ pushd ${ligaturizer}
+ mkdir -p $out/share/fonts/truetype
+ mkdir -p $out/share/fonts/opentype
+ find $out/share/fonts/truetype \
+ -name "*.ttf" \
+ -exec fontforge \
+ -lang py \
+ -script ligaturize.py {} \
+ --output-dir=$out/share/fonts/truetype \;
+ find $out/share/fonts/opentype \
+ -name "*.otf" \
+ -exec fontforge \
+ -lang py \
+ -script ligaturize.py {} \
+ --output-dir=$out/share/fonts/opentype \;
+ popd
+ '';
}
)))
- builtins.listToAttrs
]
diff --git a/packages/monocraft.nix b/packages/monocraft.nix
index cff1079..d265767 100644
--- a/packages/monocraft.nix
+++ b/packages/monocraft.nix
@@ -11,7 +11,7 @@
owner = "IdreesInc";
repo = "Monocraft";
rev = "v${version}";
- sha256 = "sha256-ePBxEVjzAJ7g6iAGIqPfgZ8bwtNILmyEVm0zD+xNN6k=";
+ sha256 = "sha256-frg7LcMv6zWPWxkr6RIl01fC68THELbb45mJVqefXC0=";
};
dontBuild = true;
diff --git a/packages/nerdfonts-glyphs.nix b/packages/nerdfonts-glyphs.nix
index ec96f74..43b6be5 100644
--- a/packages/nerdfonts-glyphs.nix
+++ b/packages/nerdfonts-glyphs.nix
@@ -5,7 +5,7 @@
}:
stdenv.mkDerivation rec {
pname = "nerdfonts-glyphs";
- version = "2.2.2";
+ version = "2.1.0";
# This uses a sparse checkout because the repo is >2GB without it
src = fetchFromGitHub {
@@ -15,7 +15,7 @@
sparseCheckout = ''
/src/glyphs
'';
- sha256 = "sha256-ePBlEVjzAJ7g6iAGIqPfgZ8bwtNILmyEVm0zD+xNN6k=";
+ sha256 = "sha256-boZUd1PM8puc9BTgOwCJpkfk6VMdXLsIyp+fQmW/ZqI=";
};
dontBuild = true;
@@ -25,6 +25,7 @@
mkdir -p $out/bin $out/share/fonts/opentype
find . -name "*.ttf" -exec mv {} $out/share/fonts/truetype \;
find . -name "*.otf" -exec mv {} $out/share/fonts/opentype \;
+
'';
meta = with lib; {
diff --git a/packages/octicons.nix b/packages/octicons.nix
index 35497bd..805425b 100644
--- a/packages/octicons.nix
+++ b/packages/octicons.nix
@@ -3,225 +3,72 @@
fetchFromGitHub,
stdenv,
fontforge,
- writeFile,
- useNerdfontsOffset ? false,
+ writeText,
+ useNerdfontsOffset ? true,
}: let
- codepoints = writeFile "codepoints.json" ''
- {
- "alert": 61485,
- "arrow-down": 61503,
- "arrow-left": 61504,
- "arrow-right": 61502,
- "arrow-small-down": 61600,
- "arrow-small-left": 61601,
- "arrow-small-right": 61553,
- "arrow-small-up": 61599,
- "arrow-up": 61501,
- "beaker": 61661,
- "bell": 61662,
- "bold": 61666,
- "book": 61447,
- "bookmark": 61563,
- "briefcase": 61651,
- "broadcast": 61512,
- "browser": 61637,
- "bug": 61585,
- "calendar": 61544,
- "check": 61498,
- "checklist": 61558,
- "chevron-down": 61603,
- "chevron-left": 61604,
- "chevron-right": 61560,
- "chevron-up": 61602,
- "circle-slash": 61572,
- "circuit-board": 61654,
- "clippy": 61493,
- "clock": 61510,
- "cloud-download": 61451,
- "cloud-upload": 61452,
- "code": 61535,
- "comment": 61483,
- "comment-discussion": 61519,
- "credit-card": 61509,
- "dash": 61642,
- "dashboard": 61565,
- "database": 61590,
- "device-camera": 61526,
- "device-camera-video": 61527,
- "device-desktop": 62076,
- "device-mobile": 61496,
- "desktop-download": 61660,
- "diff": 61517,
- "diff-added": 61547,
- "diff-ignored": 61593,
- "diff-modified": 61549,
- "diff-removed": 61548,
- "diff-renamed": 61550,
- "ellipsis": 61594,
- "eye": 61518,
- "file-binary": 61588,
- "file-code": 61456,
- "file-directory": 61462,
- "file-media": 61458,
- "file-pdf": 61460,
- "file-submodule": 61463,
- "file-symlink-directory": 61617,
- "file-symlink-file": 61616,
- "file-text": 61457,
- "file-zip": 61459,
- "flame": 61650,
- "fold": 61644,
- "gear": 61487,
- "gift": 61506,
- "gist": 61454,
- "gist-secret": 61580,
- "git-branch": 61472,
- "git-commit": 61471,
- "git-compare": 61612,
- "git-merge": 61475,
- "git-pull-request": 61449,
- "globe": 61622,
- "graph": 61507,
- "heart": 9829,
- "history": 61566,
- "home": 61581,
- "horizontal-rule": 61552,
- "hubot": 61597,
- "inbox": 61647,
- "info": 61529,
- "issue-closed": 61480,
- "issue-opened": 61478,
- "issue-reopened": 61479,
- "italic": 61668,
- "jersey": 61465,
- "key": 61513,
- "keyboard": 61453,
- "law": 61656,
- "light-bulb": 61440,
- "link": 61532,
- "link-external": 61567,
- "list-ordered": 61538,
- "list-unordered": 61537,
- "location": 61536,
- "lock": 61546,
- "logo-gist": 61613,
- "logo-github": 61586,
- "mail": 61499,
- "mail-read": 61500,
- "mail-reply": 61521,
- "mark-github": 61450,
- "markdown": 61641,
- "megaphone": 61559,
- "mention": 61630,
- "milestone": 61557,
- "mirror": 61476,
- "mortar-board": 61655,
- "mute": 61568,
- "no-newline": 61596,
- "octoface": 61448,
- "organization": 61495,
- "package": 61636,
- "paintcan": 61649,
- "pencil": 61528,
- "person": 61464,
- "pin": 61505,
- "plug": 61652,
- "plus": 61533,
- "primitive-dot": 61522,
- "primitive-square": 61523,
- "pulse": 61573,
- "question": 61484,
- "quote": 61539,
- "radio-tower": 61488,
- "repo": 61441,
- "repo-clone": 61516,
- "repo-force-push": 61514,
- "repo-forked": 61442,
- "repo-pull": 61446,
- "repo-push": 61445,
- "rocket": 61491,
- "rss": 61492,
- "ruby": 61511,
- "search": 61486,
- "server": 61591,
- "settings": 61564,
- "shield": 61665,
- "sign-in": 61494,
- "sign-out": 61490,
- "smiley": 61671,
- "squirrel": 61618,
- "star": 61482,
- "stop": 61583,
- "sync": 61575,
- "tag": 61461,
- "tasklist": 61669,
- "telescope": 61576,
- "terminal": 61640,
- "text-size": 61667,
- "three-bars": 61534,
- "thumbsup": 61658,
- "thumbsdown": 61659,
- "tools": 61489,
- "trashcan": 61648,
- "triangle-down": 61531,
- "triangle-left": 61508,
- "triangle-right": 61530,
- "triangle-up": 61610,
- "unfold": 61497,
- "unmute": 61626,
- "unverified": 61672,
- "verified": 61670,
- "versions": 61540,
- "watch": 61664,
- "x": 61569,
- "zap": 9889,
- "ellipses": 61697,
- "file": 61698,
- "grabber": 61699,
- "plus-small": 61700,
- "reply": 61701
- }
- '';
- script = writeFile "octicons.py" ''
+ pname = "octicons";
+ version = "4.4.0";
+ src = fetchFromGitHub {
+ owner = "primer";
+ repo = "octicons";
+ rev = "v${version}";
+ sha256 = "sha256-xhJRe5mO2YkqQggqZ1JHBYsJKQUSJA08crDvl22GSGg=";
+ };
+
+ script = writeText "octicons.py" ''
import fontforge
import json
-
- with open("${codepoints}/codepoints.json") as f:
+ import itertools
+
+
+ if ${
+ if useNerdfontsOffset
+ then "True"
+ else "False"
+ }:
+ validRange = list(itertools.chain((0x2665, 0x26a1), range(0xF400, 0xF4A8), (0xF112, 0xF67C)))
+ def codepointTransform(_):
+ return validRange.pop(0)
+ else:
+ codepointTransform = lambda cp: cp
+
+ offset = ${
+ if useNerdfontsOffset
+ then "0x0400"
+ else "0"
+ }
+
+ with open("${src}/lib/font/codepoints.json") as f:
codepoints = json.load(f)
font = fontforge.font()
- for name, codepoint in enumerate(codepoints):
- glyph = font.createChar(codepoint)
- glyph.importOutlines(f"./icons/{name}-24.svg")
+ for name, codepoint in sorted(codepoints.items(), key=lambda item: item[1]):
+ transformed = codepointTransform(codepoint)
+ print(name, hex(transformed))
+ glyph = font.createChar(transformed)
+ glyph.importOutlines(f"${src}/lib/svg/{name}.svg")
- font.fontname = "octicons"
+ font.familyname = "${pname}"
+ font.fullname = "${pname}"
+ font.fontname = "${pname}"
- font.save("octicons.ttf")
+ font.generate("${pname}.ttf")
'';
in
- rectdenv.mkDerivation rec {
- pname = "octicons";
- version = "17.5.0";
-
- src = fetchFromGitHub {
- owner = "primer";
- repo = "octicons";
- rev = "v${version}";
- sha256 = lib.fakeSha256;
- };
-
- dontBuild = true;
+ stdenv.mkDerivation rec {
+ inherit version src pname;
buildPhase = ''
fontforge \
-lang py \
- -script ${script}/octicons.py \;
+ -script ${script} \;
'';
installPhase = ''
- mkdir -p $out/bin $out/share/fonts/opentype
- mv octicons.ttf $out/share/fonts/opentype
+ mkdir -p $out/bin $out/share/fonts/truetype
+ mv ${pname}.ttf $out/share/fonts/truetype
+ echo $out
'';
nativeBuildInputs = [fontforge];