17 # FreeType supports LCD filtering (colloquially referred to as sub-pixel rendering).
18 # LCD filtering is also known as ClearType and covered by several Microsoft patents.
19 # This option allows it to be disabled. See http://www.freetype.org/patents.html.
20 useEncumberedCode ? true,
37 __flattenIncludeHackHook,
40 stdenv.mkDerivation (finalAttrs: {
46 inherit (finalAttrs) pname version;
49 url = "mirror://savannah/${pname}/${pname}-${version}.tar.xz";
50 sha256 = "sha256-BVA1BmbUJ8dNrrhdWse7NTrLpfdpVjlZlTEanG8GMok=";
53 propagatedBuildInputs = [
58 ]; # needed when linking against freetype
60 # dependence on harfbuzz is looser than the reverse dependence
65 __flattenIncludeHackHook
67 ++ lib.optional (!stdenv.hostPlatform.isWindows) makeWrapper
68 # FreeType requires GNU Make, which is not part of stdenv on FreeBSD.
69 ++ lib.optional (!stdenv.hostPlatform.isLinux) gnumake;
72 ./enable-table-validation.patch
73 ] ++ lib.optional useEncumberedCode ./enable-subpixel-rendering.patch;
82 "--enable-freetype-config"
85 # native compiler to generate building tool
86 CC_BUILD = "${buildPackages.stdenv.cc}/bin/cc";
88 # The asm for armel is written with the 'asm' keyword.
90 lib.optionalString stdenv.hostPlatform.isAarch32 "-std=gnu99"
91 + lib.optionalString stdenv.hostPlatform.is32bit " -D_FILE_OFFSET_BITS=64";
93 enableParallelBuilding = true;
97 # pkgsCross.mingwW64.pkg-config doesn't build
98 # makeWrapper doesn't cross-compile to windows #120726
101 substituteInPlace $dev/bin/freetype-config \
102 --replace ${buildPackages.pkg-config} ${pkgsHostHost.pkg-config}
104 + lib.optionalString (!stdenv.hostPlatform.isMinGW) ''
106 wrapProgram "$dev/bin/freetype-config" \
107 --set PKG_CONFIG_PATH "$PKG_CONFIG_PATH:$dev/lib/pkgconfig"
124 inherit (python3.pkgs) freetype-py;
125 inherit (qt5) qtbase;
126 pkg-config = testers.testMetaPkgConfig finalAttrs.finalPackage;
130 description = "Font rendering engine";
131 mainProgram = "freetype-config";
133 FreeType is a portable and efficient library for rendering fonts. It
134 supports TrueType, Type 1, CFF fonts, and WOFF, PCF, FNT, BDF and PFR
135 fonts. It has a bytecode interpreter and has an automatic hinter called
136 autofit which can be used instead of hinting instructions included in
139 homepage = "https://www.freetype.org/";
140 changelog = "https://gitlab.freedesktop.org/freetype/freetype/-/raw/VER-${
141 builtins.replaceStrings [ "." ] [ "-" ] finalAttrs.version
143 license = licenses.gpl2Plus; # or the FreeType License (BSD + advertising clause)
144 platforms = platforms.all;
145 pkgConfigModules = [ "freetype2" ];
146 maintainers = with maintainers; [ ttuegel ];