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" ]
6, harfbuzz, utf8proc
7, fcft # for passthru.tests
8}:
9
10let
11 # Needs to be reflect upstream meson_options.txt
12 availableShapingTypes = [
13 "grapheme"
14 "run"
15 ];
16
17 # Courtesy of sternenseemann and FRidh, commit c9a7fdfcfb420be8e0179214d0d91a34f5974c54
18 mesonFeatureFlag = feature: flag:
19 "-D${feature}=${if flag then "enabled" else "disabled"}";
20in
21
22stdenv.mkDerivation rec {
23 pname = "fcft";
24 version = "3.1.5";
25
26 src = fetchFromGitea {
27 domain = "codeberg.org";
28 owner = "dnkl";
29 repo = "fcft";
30 rev = version;
31 sha256 = "sha256-3gsaXnflGiGOpIkqDQe5u6x8d18x67/dc4Hh1iU89+o=";
32 };
33
34 depsBuildBuild = [ pkg-config ];
35 nativeBuildInputs = [ pkg-config meson ninja scdoc ];
36 buildInputs = [ freetype fontconfig pixman tllist ]
37 ++ lib.optionals (withShapingTypes != []) [ harfbuzz ]
38 ++ lib.optionals (builtins.elem "run" withShapingTypes) [ utf8proc ];
39 checkInputs = [ check ];
40
41 mesonBuildType = "release";
42 mesonFlags = builtins.map (t:
43 mesonFeatureFlag "${t}-shaping" (lib.elem t withShapingTypes)
44 ) availableShapingTypes;
45
46 doCheck = true;
47
48 outputs = [ "out" "doc" "man" ];
49
50 passthru.tests = {
51 noShaping = fcft.override { withShapingTypes = []; };
52 onlyGraphemeShaping = fcft.override { withShapingTypes = [ "grapheme" ]; };
53 };
54
55 meta = with lib; {
56 homepage = "https://codeberg.org/dnkl/fcft";
57 changelog = "https://codeberg.org/dnkl/fcft/releases/tag/${version}";
58 description = "Simple library for font loading and glyph rasterization";
59 maintainers = with maintainers; [
60 fionera
61 sternenseemann
62 ];
63 license = licenses.mit;
64 platforms = with platforms; linux;
65 };
66}