123.1. freetype2-2.14.3
Font rasterization library
| Version | 2.14.3, release 1 |
| Shelf | fonts — Font packages, and font libraries and tooling |
| Phase | 41_system (System), 96 of 1047 in build order |
| Licence | FTL OR GPL-2.0-or-later |
| Homepage | https://freetype.org/ |
| Build time | 0.6 SBU |
| Installed size | 2.8 MiB in 64 files |
| Recipe | ports/core/fonts/freetype2/kpkgbuild |
About
FreeType reads font files (TrueType, OpenType, Type 1, CFF, WOFF and WOFF2, PCF and BDF bitmap fonts and more) and renders their glyphs into bitmaps, with hinting. Nearly every program that draws text on KDOS reaches it, usually through fontconfig, cairo, harfbuzz or Qt, which renders the whole Plasma desktop’s text with it.
Sources
freetype2-2.14.3.tar.xz(2.5 MiB)
sha25636bc4f1cc413335368ee656c42afca65c5a3987e8768cc28cf11ba775e785a5f
upstream: https://downloads.sourceforge.net/freetype/freetype-2.14.3.tar.xz
archive copy: sources-2/fonts--freetype2-2.14.3.tar.xz
Dependencies
Depends on: zlib, bzip2, libpng, brotli.
Required by (105): appstream, ardour, audacity, avidemux, blender, cairo, calibre, calligra, cataclysm-dda, celestia, chafa, chromium, coin, crawl-tiles, ddnet, dosbox-x, ffmpeg, firefox-esr, fltk, font-manager, fontconfig, fontforge, freecad, furnace, ghostscript, gimp, gmsh, grafx2, graphicsmagick, graphviz, gtk3, gtk4, handbrake, harfbuzz, imagemagick, imhex, inkscape, ioquake3, kicad, kodi, krita, libass, libbluray, libgd, libraqm, librecad, libreoffice, librepcb, librewolf, librsvg, libXfont2, libXft, lite-xl, love, luanti, matplotlib, mkfontscale, motif, mupdf, mupen64plus, musescore, obs-studio, octave, okular, opencascade, openimageio, openjdk, openmsx, openrct2, openscad, openttd, orcaslicer, organicmaps, pango, pdf4qt, pdfium, pioneer, plasma-workspace, plutosvg, podofo, poppler, python3-pillow, qt5-qtbase, qt6-qtbase, qt6-qtwebengine, R, retroarch, scummvm, sdl2-pango, sdl2-ttf, sdl3-ttf, solvespace, supertux, supertuxkart, swayimg, texlive, thunderbird, tk, vlc, vtk, warzone2100, webkitgtk, webkitgtk6, wine, wxwidgets.
Installation
From the repository root, inside the build container, this is the line kdosbuild runs for the port:
script/chroot/exec.sh bash -c 'source script/phases/41_system/phase.env && kpkg install freetype2'
What kpkg does
kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/fonts/freetype2.
1. Verify every declared source. Each file a sha256 = line names, found in the port directory or in /var/cache/kpkg/sources, must hash to its line; a mismatch stops the build before anything is unpacked.
cd /ports/core/fonts/freetype2
echo '36bc4f1cc413335368ee656c42afca65c5a3987e8768cc28cf11ba775e785a5f freetype2-2.14.3.tar.xz' | sha256sum -c -
2. Unpack. The work directory is emptied and the first source is unpacked into $SRC with its top directory stripped; any later tarball lands unstripped beside it in $SRC_ROOT, and a file that is not a tarball is copied into $SRC.
SRC_ROOT=/var/cache/kpkg/work/freetype2
SRC=$SRC_ROOT/freetype2-2.14.3
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf freetype2-2.14.3.tar.xz -C "$SRC" --strip-components=1
Every config.guess and config.sub older than automake’s is then replaced with automake’s, so a configure script recognises the musl target.
3. Build. build.sh is sourced in a subshell under set -e, from $SRC, with name, version, release and the five paths PKGNAME, PORT_SRC, SRC_ROOT, SRC and PKG set as shell variables. Its body, verbatim:
./configure --prefix=/usr --enable-freetype-config \
--with-zlib=yes \
--with-bzip2=yes \
--with-png=yes \
--with-brotli=yes \
--with-harfbuzz=dynamic \
--with-librsvg=no
make
make DESTDIR=$PKG install
The switches, and why each is set:
--enable-freetype-config— Install thefreetype-configscript, which prints the compiler and linker flags for FreeType aspkg-config freetype2does. Off by upstream’s default; on, a build system that asks the script rather than pkg-config still finds the library.--with-zlib=yes— Decompress gzip-compressed fonts (such as.pcf.gz) with the system zlib rather than the copy FreeType carries. Namedyes, a missing library is a configure error instead of a silent fallback.--with-bzip2=yes— Read bzip2-compressed fonts (.pcf.bz2), through bzip2; required, as above.--with-png=yes— Decode the PNG glyph images of colour bitmap fonts (CBDTandsbixtables, as in noto-emoji), through libpng; without it those glyphs do not render.--with-brotli=yes— Decompress WOFF2 fonts, which are Brotli-compressed, through brotli.--with-harfbuzz=dynamic— The autohinter uses HarfBuzz to find the glyphs that OpenType features reach (small capitals, ligatures, alternates) and hint them like their base letters. Withdynamic, FreeType does not linklibharfbuzz; it callsdlopen("libharfbuzz.so.0")at run time and does without it when the library is absent. HarfBuzz is built against FreeType, so linking it here would be a dependency cycle.--with-librsvg=no— Do not look for librsvg. Upstream uses it only to render OpenType SVG glyphs in FreeType’s demo programs, which this port does not build, so the library is the same either way.
The common switches of each build system are explained in the Flag glossary.
4. Package. kpkg removes libtool archives, the info directory index, mimeinfo.cache and every fonts.dir from $PKG, copies the source’s licence files into /usr/share/licenses/freetype2, prunes what the image does not ship, lints the tree and rolls it reproducibly:
tar --sort=name --format=gnu --numeric-owner --owner=0 --group=0 \
--mtime=@$SOURCE_DATE_EPOCH \
--use-compress-program='xz -9 -T0 --block-size=32MiB --no-adjust' \
-cf freetype2-2.14.3-1.tar.xz -C "$PKG" .
5. Adopt. kpkgadd installs the package’s files over the root, refusing a path another package owns, records the file list in /var/lib/kpkg/db/freetype2, and runs the triggers its paths call for.
Contents
Installed programs: freetype-config.
Installed libraries: libfreetype.a, libfreetype.so.
Installed directories: /usr/include/freetype2, /usr/share/licenses/freetype2.
Short descriptions
freetype-config |
Get information about a libfreetype installation |
freetype2.pc |
A free, high-quality, and portable font engine. |
Notes
Because HarfBuzz is reached only through dlopen, readelf -d /usr/lib/libfreetype.so does not list it, and no dependency records it: the autohinter’s OpenType support is there exactly when the harfbuzz package is installed, and FreeType falls back to hinting without it, with no error, when libharfbuzz.so.0 cannot be loaded.