summary refs log tree commit diff
path: root/pkgs/tools/typesetting/tex/mftrace/default.nix
blob: 4b8a0350c8b1597fa39984719799d6f6e8d91076 (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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
{ stdenv
, fetchFromGitHub
, lib
, makeWrapper
, autoreconfHook
, python3
, fontforge
, potrace
, texlive
}:

/*
  To use with a texlive distribution, ensure that the desired fonts and
  the packages kpathsea, t1utils, metafont are available at runtime.

  Possible overrides:
  - potrace = autotrace
  - fontforge = ghostscript (limited functionality)
  - fontforge = null (limited functionality)
*/

stdenv.mkDerivation (finalAttrs: rec {
  pname = "mftrace";
  version = "1.2.20";

  # https://lilypond.org/download/sources/mftrace/mftrace-1.2.20.tar.gz
  # is incomplete, fetch repo and use autoconf instead
  # see https://github.com/hanwen/mftrace/issues/13
  src = fetchFromGitHub {
    owner = "hanwen";
    repo = "mftrace";
    rev = "release/${version}";
    sha256 = "02ik25aczkbi10jrjlnxby3fmixxrwm2k5r4fkfif3bjfym7nqbc";
  };

  nativeBuildInputs = [ makeWrapper autoreconfHook python3 potrace ];

  buildInputs = [ fontforge potrace ];

  postInstall = ''
    wrapProgram $out/bin/mftrace --prefix PATH : ${lib.makeBinPath finalAttrs.buildInputs}
  '';

  # experimental texlive.combine support
  # (note that only the bin/ folder will be combined into texlive)
  passthru = {
    tlType = "bin";
    tlDeps = with texlive; [ kpathsea t1utils metafont ];
    pkgs = [ finalAttrs.finalPackage ];
  };

  meta = with lib; {
    description = "Scalable PostScript Fonts for MetaFont";
    longDescription = ''
      mftrace is a small Python program that lets you trace a TeX bitmap
      font into a PFA or PFB font (A PostScript Type1 Scalable Font) or
      TTF (TrueType) font.
    '';
    homepage = "https://lilypond.org/mftrace/";
    license = with licenses; [ gpl2Only mit ];
    maintainers = with maintainers; [ xworld21 ];
    platforms = platforms.all;
  };
})