openmoji-color,openmoji-black: 14.0.0 -> 15.0.0

authored by Sophie Tauchert and committed by Francesco Gazzetta 3da286db dbdb1f1b

+129 -60
+77
pkgs/data/fonts/openmoji/build.patch
··· 1 + diff --git a/helpers/generate-fonts-runner.sh b/helpers/generate-fonts-runner.sh 2 + index 21267e50f..873b5c664 100755 3 + --- a/helpers/generate-fonts-runner.sh 4 + +++ b/helpers/generate-fonts-runner.sh 5 + @@ -25,10 +25,10 @@ mkdir -p "$build_dir" 6 + 7 + # Change these to enable/disable formats 8 + # Remember to update font/README.md accordingly 9 + -methods_black=(glyf) 10 + -methods_color=(cbdt glyf_colr_0 glyf_colr_1 sbix picosvgz untouchedsvgz) 11 + +#methods_black=(glyf) 12 + +#methods_color=(cbdt glyf_colr_0 glyf_colr_1 sbix picosvgz untouchedsvgz) 13 + 14 + -saturations=(black color) 15 + +#saturations=(black color) 16 + for saturation in "${saturations[@]}"; do 17 + case "$saturation" in 18 + black) 19 + @@ -43,6 +43,7 @@ for saturation in "${saturations[@]}"; do 20 + mkdir -p "$build_dir/$saturation" 21 + 22 + for method in "${methods[@]}"; do 23 + + if [ -z "$method" ]; then continue; fi 24 + cat >"$build_dir/$saturation/OpenMoji-$saturation-$method.toml" <<-EOF 25 + output_file = "$build_dir/$saturation/OpenMoji-$saturation-$method.ttf" 26 + color_format = "$method" 27 + @@ -55,10 +56,7 @@ default = 400 28 + 29 + [master.regular] 30 + style_name = "Regular" 31 + - 32 + -# To quickly check build reverse comments below 33 + -srcs = ["/mnt/$saturation/svg/*.svg"] 34 + -# srcs = ["/mnt/$saturation/svg/1F923.svg", "/mnt/$saturation/svg/1F1E9-1F1F0.svg"] 35 + +srcs = ["$(pwd)/$saturation/svg/*.svg"] 36 + 37 + [master.regular.position] 38 + wght = 400 39 + @@ -71,7 +69,7 @@ EOF 40 + for method in "${methods[@]}"; do 41 + # Generate XML for font 42 + sed "s/Color/${saturation^}/;" \ 43 + - /mnt/data/OpenMoji-Color.ttx \ 44 + + data/OpenMoji-Color.ttx \ 45 + > "$build_dir/$saturation/OpenMoji-$saturation-$method.ttx" 46 + 47 + # Add version to XML 48 + @@ -89,25 +87,21 @@ EOF 49 + 50 + # Compress with WOFF2 51 + woff2_compress "$build_dir/fonts/OpenMoji-$saturation-$method/OpenMoji-$saturation-$method.ttf" 52 + - 53 + - # Generate font demo 54 + - /mnt/helpers/generate-font-demo.js "OpenMoji-$saturation-$method.woff2" "$build_dir/fonts/OpenMoji-$saturation-$method" 55 + done 56 + done 57 + 58 + -for colr_version in 0 1; do 59 + +for colr_version in "${maximumColorVersions[@]}"; do 60 + + if [ -z "$colr_version" ]; then continue; fi 61 + # Make TTF with both COLR and SVG font data in it 62 + mkdir -p "$build_dir/fonts/OpenMoji-color-colr${colr_version}_svg" 63 + 64 + - maximum_color \ 65 + + maximum_color --build_dir="$build_dir/color" \ 66 + "$build_dir/fonts/OpenMoji-color-glyf_colr_${colr_version}/OpenMoji-color-glyf_colr_${colr_version}.ttf"\ 67 + --output_file "$build_dir/fonts/OpenMoji-color-colr${colr_version}_svg/OpenMoji-color-colr${colr_version}_svg.ttf" 68 + 69 + woff2_compress "$build_dir/fonts/OpenMoji-color-colr${colr_version}_svg/OpenMoji-color-colr${colr_version}_svg.ttf" 70 + 71 + - /mnt/helpers/generate-font-demo.js\ 72 + - "OpenMoji-color-colr${colr_version}_svg.woff2"\ 73 + - "$build_dir/fonts/OpenMoji-color-colr${colr_version}_svg" 74 + + rm -rf "$build_dir/fonts/OpenMoji-color-glyf_colr_${colr_version}" 75 + done 76 + 77 + echo "Done building fonts!"
+50 -58
pkgs/data/fonts/openmoji/default.nix
··· 1 1 { lib 2 - , stdenv 2 + , stdenvNoCC 3 3 , fetchFromGitHub 4 - , fetchpatch 5 - , scfbuild 6 - , fontforge 7 - , node-glob 8 - , libuninameslist 9 - , nodejs 10 - , nodePackages 4 + , nanoemoji 11 5 , python3Packages 12 - , variant ? "color" # "color" or "black" 6 + , woff2 7 + , xmlstarlet 8 + # available color formats: ["cbdt" "glyf_colr_0" "glyf_colr_1" "sbix" "picosvgz" "untouchedsvgz"] 9 + # available black formats: ["glyf"] 10 + , fontFormats ? [ "glyf" "cbdt" "glyf_colr_0" "glyf_colr_1" ] 11 + # when at least one of the glyf_colr_0/1 formats is specified, whether to build maximum color fonts 12 + # "none" to not build any, "svg" to build colr+svg, "bitmap" to build cbdt+colr+svg fonts 13 + , buildMaximumColorFonts ? "bitmap" 13 14 }: 14 - 15 15 let 16 - filename = builtins.replaceStrings 17 - [ "color" "black" ] 18 - [ "OpenMoji-Color.ttf" "OpenMoji-Black.ttf" ] 19 - variant; 16 + # all available methods 17 + methods = { 18 + black = [ "glyf" ]; 19 + color = [ "cbdt" "glyf_colr_0" "glyf_colr_1" "sbix" "picosvgz" "untouchedsvgz" ]; 20 + }; 21 + in 20 22 21 - # With newer fontforge the build hangs, see 22 - # https://github.com/NixOS/nixpkgs/issues/167869 23 - # Patches etc taken from 24 - # https://github.com/NixOS/nixpkgs/commit/69da642a5a9bb433138ba1b13c8d56fb5bb6ec05 25 - fontforge-20201107 = fontforge.overrideAttrs (old: rec { 26 - version = "20201107"; 27 - src = fetchFromGitHub { 28 - owner = "fontforge"; 29 - repo = "fontforge"; 30 - rev = version; 31 - sha256 = "sha256-Rl/5lbXaPgIndANaD0IakaDus6T53FjiBb45FIuGrvc="; 32 - }; 33 - patches = [ 34 - (fetchpatch { 35 - url = "https://salsa.debian.org/fonts-team/fontforge/raw/76bffe6ccf8ab20a0c81476a80a87ad245e2fd1c/debian/patches/0001-add-extra-cmake-install-rules.patch"; 36 - sha256 = "u3D9od2xLECNEHhZ+8dkuv9818tPkdP6y/Tvd9CADJg="; 37 - }) 38 - (fetchpatch { 39 - url = "https://github.com/fontforge/fontforge/commit/69e263b2aff29ad22f97f13935cfa97a1eabf207.patch"; 40 - sha256 = "06yyf90605aq6ppfiz83mqkdmnaq5418axp9jgsjyjq78b00xb29"; 41 - }) 42 - ]; 43 - buildInputs = old.buildInputs ++ [ libuninameslist ]; 44 - }); 45 - scfbuild-with-fontforge-20201107 = scfbuild.override (old: { 46 - fontforge = fontforge-20201107; 47 - }); 23 + assert lib.asserts.assertEachOneOf "fontFormats" fontFormats (methods.black ++ methods.color); 24 + assert lib.asserts.assertOneOf "buildMaximumColorFonts" buildMaximumColorFonts [ "none" "bitmap" "svg" ]; 48 25 49 - in stdenv.mkDerivation rec { 26 + stdenvNoCC.mkDerivation rec { 50 27 pname = "openmoji"; 51 - version = "14.0.0"; 28 + version = "15.0.0"; 52 29 53 30 src = fetchFromGitHub { 54 31 owner = "hfg-gmuend"; 55 32 repo = pname; 56 33 rev = version; 57 - sha256 = "sha256-XnSRSlWXOMeSaO6dKaOloRg3+sWS4BSaro4bPqOyKmE="; 34 + hash = "sha256-659ONkHU45Z2789ay0yLero9j5nFWhslpJad++4oNN8="; 58 35 }; 59 36 37 + patches = [ 38 + # fix paths and variables for nix build and skip generating font demos 39 + ./build.patch 40 + ]; 41 + 60 42 nativeBuildInputs = [ 61 - scfbuild-with-fontforge-20201107 62 - nodejs 63 - node-glob 64 - nodePackages.lodash 43 + nanoemoji 44 + python3Packages.fonttools 45 + woff2 46 + xmlstarlet 65 47 ]; 66 48 67 - postPatch = '' 68 - # this is API change in glob >9 69 - substituteInPlace helpers/generate-font-glyphs.js \ 70 - --replace "require('glob').sync" "require('glob').globSync" 49 + methods_black = builtins.filter (m: builtins.elem m fontFormats) methods.black; 50 + methods_color = builtins.filter (m: builtins.elem m fontFormats) methods.color; 51 + saturations = lib.optional (methods_black != [ ]) "black" ++ lib.optional (methods_color != [ ]) "color"; 52 + maximumColorVersions = lib.optionals (buildMaximumColorFonts != "none") ( 53 + lib.optional (builtins.elem "glyf_colr_0" fontFormats) "0" 54 + ++ lib.optional (builtins.elem "glyf_colr_1" fontFormats) "1" 55 + ); 56 + 57 + postPatch = lib.optionalString (buildMaximumColorFonts == "bitmap") '' 58 + substituteInPlace helpers/generate-fonts-runner.sh \ 59 + --replace 'maximum_color' 'maximum_color --bitmaps' 71 60 ''; 72 61 73 62 buildPhase = '' 74 63 runHook preBuild 75 64 76 - node helpers/generate-font-glyphs.js 77 - 78 - cd font 79 - scfbuild -c scfbuild-${variant}.yml 65 + bash helpers/generate-fonts-runner.sh "$(pwd)/build" "${version}" 80 66 81 67 runHook postBuild 82 68 ''; 83 69 84 70 installPhase = '' 85 - install -Dm644 ${filename} $out/share/fonts/truetype/${filename} 71 + runHook preInstall 72 + 73 + mkdir -p $out/share/fonts/truetype $out/share/fonts/woff2 74 + cp build/fonts/*/*.ttf $out/share/fonts/truetype/ 75 + cp build/fonts/*/*.woff2 $out/share/fonts/woff2/ 76 + 77 + runHook postInstall 86 78 ''; 87 79 88 80 meta = with lib; { 89 81 license = licenses.cc-by-sa-40; 90 - maintainers = with maintainers; [ fgaz ]; 82 + maintainers = with maintainers; [ _999eagle fgaz ]; 91 83 platforms = platforms.all; 92 84 homepage = "https://openmoji.org/"; 93 85 downloadPage = "https://github.com/hfg-gmuend/openmoji/releases";
+2 -2
pkgs/top-level/all-packages.nix
··· 29395 29395 29396 29396 open-sans = callPackage ../data/fonts/open-sans { }; 29397 29397 29398 - openmoji-color = callPackage ../data/fonts/openmoji { variant = "color"; }; 29398 + openmoji-color = callPackage ../data/fonts/openmoji { fontFormats = ["glyf_colr_0"]; }; 29399 29399 29400 - openmoji-black = callPackage ../data/fonts/openmoji { variant = "black"; }; 29400 + openmoji-black = callPackage ../data/fonts/openmoji { fontFormats = ["glyf"]; }; 29401 29401 29402 29402 openzone-cursors = callPackage ../data/themes/openzone { }; 29403 29403