Unverified Commit 1ce92c15 authored by Sophie Tauchert's avatar Sophie Tauchert Committed by Sophie Tauchert
Browse files

nanoemoji: init at 0.15.1

parent aaef56b7
Loading
Loading
Loading
Loading
+72 −0
Original line number Diff line number Diff line
{ lib
, python3
, fetchFromGitHub
, resvg
, pngquant
}:
python3.pkgs.buildPythonApplication rec {
  pname = "nanoemoji";
  version = "0.15.1";

  src = fetchFromGitHub {
    owner = "googlefonts";
    repo = pname;
    rev = "v${version}";
    hash = "sha256-P/lT0PnjTdYzyttICzszu4OL5kj+X8GHZ8doL3tpXQM=";
  };
  patches = [
    # this is necessary because the tests clear PATH/PYTHONPATH otherwise
    ./test-pythonpath.patch
    # minor difference in the test output, most likely due to different dependency versions
    ./fix-test.patch
  ];

  nativeBuildInputs = with python3.pkgs; [
    setuptools-scm
    pythonRelaxDepsHook

    pngquant
    resvg
  ];

  # these two packages are just prebuilt wheels containing the respective binaries
  pythonRemoveDeps = [ "pngquant-cli" "resvg-cli" ];

  propagatedBuildInputs = with python3.pkgs; [
    absl-py
    fonttools
    lxml
    ninja-python
    picosvg
    pillow
    regex
    toml
    tomlkit
    ufo2ft
    ufoLib2
    zopfli
  ];

  nativeCheckInputs = with python3.pkgs; [
    pytestCheckHook

    ninja-python
    picosvg
  ];

  makeWrapperArgs = [
    "--prefix PATH : ${lib.makeBinPath [ pngquant resvg ]}"
  ];

  preCheck = ''
    # make sure the built binaries (nanoemoji/maximum_color) can be found by the test
    export PATH="$out/bin:''${PATH}"
  '';

  meta = with lib; {
    description = "A wee tool to build color fonts";
    homepage = "https://github.com/googlefonts/nanoemoji";
    license = licenses.asl20;
    maintainers = with maintainers; [ _999eagle ];
  };
}
+24 −0
Original line number Diff line number Diff line
--- a/tests/proportional_cbdt.ttx
+++ b/tests/proportional_cbdt.ttx
@@ -13,7 +13,7 @@
     <mtx name=".notdef" width="0" lsb="5"/>
     <mtx name=".space" width="0" lsb="0"/>
     <mtx name="e000" width="110" lsb="0"/>
-    <mtx name="e001" width="73" lsb="0"/>
+    <mtx name="e001" width="74" lsb="0"/>
   </hmtx>
 
   <cmap>
@@ -79,10 +79,10 @@
       <cbdt_bitmap_format_17 name="e001">
         <SmallGlyphMetrics>
           <height value="128"/>
-          <width value="85"/>
+          <width value="86"/>
           <BearingX value="0"/>
           <BearingY value="104"/>
-          <Advance value="85"/>
+          <Advance value="86"/>
         </SmallGlyphMetrics>
         <extfileimagedata value="e001.png"/>
       </cbdt_bitmap_format_17>
+14 −0
Original line number Diff line number Diff line
--- a/tests/test_helper.py
+++ b/tests/test_helper.py
@@ -269,9 +269,9 @@
     print("subprocess:", " ".join(cmd))  # very useful on failure
     env = {
         # We may need to find nanoemoji and other pip-installed cli tools
-        "PATH": str(Path(shutil.which("nanoemoji")).parent),
+        "PATH": str(Path(shutil.which("nanoemoji")).parent) + ":" + os.environ["PATH"],
         # We may need to find test modules
-        "PYTHONPATH": os.pathsep.join((str(Path(__file__).parent),)),
+        "PYTHONPATH": os.pathsep.join((str(Path(__file__).parent),)) + ":" + os.environ["PYTHONPATH"],
     }
     # Needed for windows CI to function; ref https://github.com/appveyor/ci/issues/1995
     if "SYSTEMROOT" in os.environ:
+2 −0
Original line number Diff line number Diff line
@@ -9727,6 +9727,8 @@ with pkgs;
    pythonPackages = python3Packages;
  };
  nanoemoji = python3Packages.callPackage ../tools/misc/nanoemoji { };
  nagelfar = callPackage ../development/tools/nagelfar { };
  nats-top = callPackage ../tools/system/nats-top { };