summary refs log tree commit diff
path: root/pkgs/data/fonts/xits-math/default.nix
blob: 25431c7f9d7020c6236a6cb3624886d889efa99b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
{ stdenv, fetchFromGitHub, python2Packages, fontforge }:

stdenv.mkDerivation rec {
  name = "xits-math-${version}";
  version = "1.108";

  src = fetchFromGitHub {
    owner = "khaledhosny";
    repo = "xits-math";
    rev = "v${version}";
    sha256 = "08nn676c41a7gmmhrzi8mm0g74z8aiaafjk48pqcwxvjj9av7xjg";
  };

  nativeBuildInputs = [ fontforge ] ++ (with python2Packages; [ python fonttools ]);

  postPatch = ''
    rm *.otf

    substituteInPlace tools/postprocess.py --replace \
      'font = ttLib.TTFont(sys.argv[1])' \
      'font = ttLib.TTFont(sys.argv[1], recalcTimestamp=False)'
  '';

  installPhase = ''
    mkdir -p $out/share/fonts/opentype
    cp *.otf $out/share/fonts/opentype
  '';

  outputHashAlgo = "sha256";
  outputHashMode = "recursive";
  outputHash = "00xycmb9ka67j5s66nkng53y8q6362igisxz04zb58r2717jk50m";

  meta = with stdenv.lib; {
    homepage = https://github.com/khaledhosny/xits-math;
    description = "OpenType implementation of STIX fonts with math support";
    license = licenses.ofl;
    platforms = platforms.all;
    maintainers = with maintainers; [ abbradar ];
  };
}