1 { stdenv, lib, fetchFromGitea, pkg-config, meson, ninja, scdoc
2 , freetype, fontconfig, pixman, tllist, check
3 # Text shaping methods to enable, empty list disables all text shaping.
4 # See `availableShapingTypes` or upstream meson_options.txt for available types.
5 , withShapingTypes ? [ "grapheme" "run" ]
7 , fcft # for passthru.tests
11 # Needs to be reflect upstream meson_options.txt
12 availableShapingTypes = [
17 # Courtesy of sternenseemann and FRidh, commit c9a7fdfcfb420be8e0179214d0d91a34f5974c54
18 mesonFeatureFlag = opt: b: "-D${opt}=${if b then "enabled" else "disabled"}";
21 stdenv.mkDerivation rec {
25 src = fetchFromGitea {
26 domain = "codeberg.org";
30 sha256 = "sha256-3gsaXnflGiGOpIkqDQe5u6x8d18x67/dc4Hh1iU89+o=";
33 depsBuildBuild = [ pkg-config ];
34 nativeBuildInputs = [ pkg-config meson ninja scdoc ];
35 buildInputs = [ freetype fontconfig pixman tllist ]
36 ++ lib.optionals (withShapingTypes != []) [ harfbuzz ]
37 ++ lib.optionals (builtins.elem "run" withShapingTypes) [ utf8proc ];
38 checkInputs = [ check ];
40 mesonBuildType = "release";
41 mesonFlags = builtins.map (t:
42 mesonFeatureFlag "${t}-shaping" (lib.elem t withShapingTypes)
43 ) availableShapingTypes;
47 outputs = [ "out" "doc" "man" ];
50 noShaping = fcft.override { withShapingTypes = []; };
51 onlyGraphemeShaping = fcft.override { withShapingTypes = [ "grapheme" ]; };
55 homepage = "https://codeberg.org/dnkl/fcft";
56 changelog = "https://codeberg.org/dnkl/fcft/releases/tag/${version}";
57 description = "Simple library for font loading and glyph rasterization";
58 maintainers = with maintainers; [
62 license = licenses.mit;
63 platforms = with platforms; linux;