-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
nixpkgs: Add NerdFont-patched Iosevka (called Imposevka)
Patching script from ryanoasis/nerd-fonts#83 (comment)
- Loading branch information
Showing
5 changed files
with
66 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
SRCFILES=$(shell ls src/) | ||
SOURCES=$(addprefix src/,$(SRCFILES)) | ||
TARGETS=$(addprefix dst/,$(subst iosevka-,imposevka-,$(SRCFILES))) | ||
SOURCE_OTDS=$(addprefix tmp/,$(subst .ttf,.otd,$(SRCFILES))) | ||
TARGET_OTDS=$(addprefix tmp/,$(subst iosevka-,imposevka-,$(subst .ttf,.otd,$(SRCFILES)))) | ||
|
||
all : $(TARGETS) | ||
|
||
tmp/nerd.otd : nerd.ttf | ||
otfccdump $< -o $@ --glyph-name-prefix .2. --ignore-hints | ||
|
||
$(TARGETS) : dst/imposevka-%.ttf : tmp/imposevka-%.otd | ||
@otfccbuild $< -o $@ --keep-average-char-width --ship | ||
@echo Patched $@ | ||
$(TARGET_OTDS) : tmp/imposevka-%.otd : merge.js tmp/iosevka-%.otd tmp/nerd.otd | ||
@node $^ $@ | ||
$(SOURCE_OTDS) : tmp/iosevka-%.otd : src/iosevka-%.ttf | ||
@otfccdump $< -o $@ --glyph-name-prefix .1. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
var fs = require('fs'); | ||
var orig = JSON.parse(fs.readFileSync(process.argv[2], 'utf-8')); | ||
var patch = JSON.parse(fs.readFileSync(process.argv[3], 'utf-8')); | ||
for(var k in patch.cmap) { | ||
if(!orig.cmap[k]) { orig.cmap[k] = patch.cmap[k] } | ||
} | ||
for(var k in patch.glyf) { | ||
if(!orig.glyf[k]) { orig.glyf[k] = patch.glyf[k] } | ||
} | ||
for(var j = 0; j < orig.name.length; j++){ | ||
orig.name[j].nameString = orig.name[j].nameString.replace(/Iosevka/g, 'Imposevka'); | ||
} | ||
fs.writeFileSync(process.argv[4], JSON.stringify(orig)) |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
{ stdenv, otfcc, iosevka, nodejs-6_x }: | ||
|
||
stdenv.mkDerivation rec { | ||
name = "imposevka-${iosevka.version}"; | ||
|
||
src = ./imposevka-patcher; | ||
|
||
nativeBuildInputs = [ otfcc nodejs-6_x ]; | ||
|
||
buildPhase = '' | ||
mkdir src | ||
mkdir dst | ||
mkdir tmp | ||
cp -v ${iosevka}/share/fonts/truetype/iosevka-* src/ | ||
make | ||
''; | ||
|
||
installPhase = '' | ||
fontdir=$out/share/fonts/truetype | ||
mkdir -p $fontdir | ||
cp -v dst/* $fontdir | ||
''; | ||
|
||
meta = with stdenv.lib; { | ||
homepage = "https://github.com/ryanoasis/nerd-fonts"; | ||
description = '' | ||
NerdFont patched Iosevka | ||
''; | ||
platforms = platforms.all; | ||
maintainers = [ maintainers.fmthoma ]; | ||
}; | ||
} |