1 { lib, stdenv, fetchFromGitHub, fontforge, python3 }:
3 inherit (python3.pkgs) fonttools;
5 commonNativeBuildInputs = [ fontforge python3 ];
7 { version, repo, sha256, docsToInstall, nativeBuildInputs, postPatch ? null }:
8 stdenv.mkDerivation rec {
9 pname = "liberation-fonts";
12 src = fetchFromGitHub {
13 owner = "liberationfonts";
18 inherit nativeBuildInputs postPatch;
21 find . -name '*.ttf' -exec install -m444 -Dt $out/share/fonts/truetype {} \;
23 for i in ${toString docsToInstall}; do
24 # not all docs exist in all versions
25 install -m444 -Dt $out/share/doc/${pname}-${version} $i || true
30 description = "Liberation Fonts, replacements for Times New Roman, Arial, and Courier New";
32 The Liberation Fonts are intended to be replacements for the three most
33 commonly used fonts on Microsoft systems: Times New Roman, Arial, and
34 Courier New. Since 2012 they are based on croscore fonts.
36 There are three sets: Sans (a substitute for Arial, Albany, Helvetica,
37 Nimbus Sans L, and Bitstream Vera Sans), Serif (a substitute for Times
38 New Roman, Thorndale, Nimbus Roman, and Bitstream Vera Serif) and Mono
39 (a substitute for Courier New, Cumberland, Courier, Nimbus Mono L, and
40 Bitstream Vera Sans Mono).
43 license = licenses.ofl;
44 homepage = "https://github.com/liberationfonts";
45 maintainers = with maintainers; [ raskin ];
50 liberation_ttf_v1 = common {
51 repo = "liberation-1.7-fonts";
53 docsToInstall = [ "AUTHORS" "ChangeLog" "COPYING" "License.txt" "README" ];
54 nativeBuildInputs = commonNativeBuildInputs;
55 sha256 = "1ffl10mf78hx598sy9qr5m6q2b8n3mpnsj73bwixnd4985gsz56v";
57 liberation_ttf_v2 = common {
58 repo = "liberation-fonts";
60 docsToInstall = [ "AUTHORS" "ChangeLog" "LICENSE" "README.md" ];
61 nativeBuildInputs = commonNativeBuildInputs ++ [ fonttools ];
63 substituteInPlace scripts/setisFixedPitch-fonttools.py --replace \
64 'font = ttLib.TTFont(fontfile)' \
65 'font = ttLib.TTFont(fontfile, recalcTimestamp=False)'
67 sha256 = "Wg1uoD2k/69Wn6XU+7wHqf2KO/bt4y7pwgmG7+IUh4Q=";