openmoji-black,openmoji-color: init at 12.0.0

This commit is contained in:
Francesco Gazzetta 2019-10-01 15:43:42 +02:00
parent b9a3c230bd
commit 4a377fd617
2 changed files with 83 additions and 0 deletions

View File

@ -0,0 +1,79 @@
{ stdenv
, fetchFromGitHub
, scfbuild
, variant ? "color" # "color" or "black"
}:
let
filename = builtins.replaceStrings
[ "color" "black" ]
[ "OpenMoji-Color.ttf" "OpenMoji-Black.ttf" ]
variant;
in stdenv.mkDerivation rec {
pname = "openmoji";
version = "12.0.0";
src = fetchFromGitHub {
owner = "hfg-gmuend";
repo = pname;
rev = version;
sha256 = "0h8sr74gbdmcm8vv8pxlig50mmbf9w9lh4p8ih2lqqi5iry1dvhj";
};
nativeBuildInputs = [
scfbuild
];
# Some id and data-* attributes in the svg files contain unicode characters,
# which scfbuild (a python2 program) does not like
# (https://github.com/13rac1/scfbuild/issues/14).
# Fortunately, it's only metadata which we can remove:
postPatch = ''
sed -Ei 's/(id|data-[^=]*)="[^"]*"//g' black/svg/*.svg color/svg/*.svg
'';
buildPhase = ''
# Bash reimplementation of helpers/export-svg-font.js
# so we don't need to build all the node deps first
hexcodes=()
missingGlyphBlack='./black/svg/25A1.svg'
missingGlyphColor='./color/svg/25A1.svg'
for f in ./color/svg/*.svg; do
basename=$(basename "$f" .svg)
hexcodes+=(''${basename//-/ })
filename=$(basename "$f");
cp "./color/svg/$filename" "./font/tmp-color/$filename"
cp "./black/svg/$filename" "./font/tmp-black/$filename"
done
hexcodes=($(uniq<<<"$hexcodes"))
for h in $hexcodes; do
filename="$h.svg"
if [ ! -e "./color/svg/$filename" ]; then
echo "$h is missing -> substitute with \"Missing Glyph\": $filename"
cp $missingGlyphColor "./font/tmp-color/$filename"
cp $missingGlyphBlack "./font/tmp-black/$filename"
fi
done
# Actually build the font:
cd font
scfbuild -c scfbuild-${variant}.yml
'';
installPhase = ''
install -Dm644 ${filename} $out/share/fonts/truetype/${filename}
'';
meta = with stdenv.lib; {
license = licenses.cc-by-sa-40;
maintainers = with maintainers; [ fgaz ];
platforms = platforms.all;
homepage = "https://openmoji.org/";
downloadPage = "https://github.com/hfg-gmuend/openmoji/releases";
description = "Open-source emojis for designers, developers and everyone else";
};
}

View File

@ -22589,6 +22589,10 @@ in
open-sans = callPackage ../data/fonts/open-sans { };
openmoji-color = callPackage ../data/fonts/openmoji { variant = "color"; };
openmoji-black = callPackage ../data/fonts/openmoji { variant = "black"; };
openzone-cursors = callPackage ../data/themes/openzone { };
oranchelo-icon-theme = callPackage ../data/icons/oranchelo-icon-theme { };