2022-01-01 04:17:54 +00:00
|
|
|
{ nerdfonts
|
2021-12-29 01:56:11 +00:00
|
|
|
, python3
|
2022-01-01 04:17:54 +00:00
|
|
|
, runCommand
|
2021-12-29 01:56:11 +00:00
|
|
|
, writeScript
|
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
|
|
|
py = python3.withPackages (p: [ p.fontforge ]);
|
|
|
|
|
2022-01-01 04:17:54 +00:00
|
|
|
src = nerdfonts.override { fonts = [ "DejaVuSansMono" ]; };
|
|
|
|
|
2021-12-29 01:56:11 +00:00
|
|
|
# Stick a rectangle on the left edge of the
|
|
|
|
# powerline symbol to avoid anti-aliasing artifacts
|
|
|
|
postprocess = writeScript "postprocess.py" ''
|
|
|
|
#!${py}/bin/python
|
|
|
|
import fontforge, psMat, sys, os
|
|
|
|
f = fontforge.open(sys.argv[1])
|
|
|
|
glyph = f[0xE0B0]
|
|
|
|
bb = glyph.boundingBox()
|
|
|
|
pen = glyph.glyphPen(replace=False)
|
2022-01-01 04:17:54 +00:00
|
|
|
pen.moveTo(0, bb[1])
|
|
|
|
pen.lineTo(0, bb[3])
|
|
|
|
pen.lineTo(-150, bb[3])
|
|
|
|
pen.lineTo(-150, bb[1])
|
2021-12-29 01:56:11 +00:00
|
|
|
pen.closePath()
|
|
|
|
os.unlink(sys.argv[1])
|
|
|
|
f.generate(sys.argv[1])
|
|
|
|
'';
|
|
|
|
|
|
|
|
in
|
2022-01-01 04:17:54 +00:00
|
|
|
runCommand "bck-nerdfont" { inherit src; } ''
|
|
|
|
find $src -name '*Complete.ttf' -exec install -D -t $out/share/fonts/truetype {} \;
|
|
|
|
find $out -name '*Complete.ttf' -exec ${postprocess} {} \;
|
|
|
|
''
|