A simple library for font loading and glyph rasterization using FontConfig, FreeType and pixman.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Daniel Eklöf 89ffb2d451
meson: add ‘Documentation: YES|NO’ to summary
6 days ago
.builds ci: -Dtext-shaping -> -Dgrapheme-shaping + -Drun-shaping 4 weeks ago
doc meson: make scdoc optional 2 weeks ago
example fcft: add fcft_set_emoji_presentation() 1 month ago
fcft codespell: multple -> multiple 1 month ago
unicode unicode: add emoji-data.txt 1 month ago
.gitignore gitignore: subprojects directory 1 year ago
.gitlab-ci.yml ci: -Dtext-shaping -> -Dgrapheme-shaping + -Drun-shaping 4 weeks ago
.gitmodules tllist: remove submodule 1 year ago
.woodpecker.yml ci: -Dtext-shaping -> -Dgrapheme-shaping + -Drun-shaping 4 weeks ago
CHANGELOG.md changelog: add entry about scdoc and -Ddocs switch 1 week ago
LICENSE license: add missing license (MIT) file. Closes #3 1 year ago
PKGBUILD meson/pkgbuild: bump version to 2.5.0 3 weeks ago
README.md readme: document that scdoc is optional and can be disabled with -Ddocs 1 week ago
fcft.c meson: replace -Dtext-shaping with -Dgrapheme-shaping + -Drun-shaping 4 weeks ago
generate-emoji-data.py generate-emoji-data: compact the array by storing ranges 1 month ago
generate-unicode-precompose.sh meson: generate a table of pre-composed unicode characters 2 years ago
generate-version.sh generate-version: handle git repo not having any tags 2 months ago
log.c log: print to stderr 6 months ago
log.h log: improve logging configurability 8 months ago
meson.build meson: add ‘Documentation: YES|NO’ to summary 6 days ago
meson_options.txt meson: make scdoc optional 2 weeks ago
screenshot.png readme: add screenshot 4 months ago
test.c meson: replace -Dtext-shaping with -Dgrapheme-shaping + -Drun-shaping 4 weeks ago


CI status


Packaging status

fcft is a small font loading and glyph rasterization library built on-top of FontConfig, FreeType2 and pixman.

It can load and cache fonts from a fontconfig-formatted name string, e.g. Monospace:size=12, optionally with user configured fallback fonts.

After a font has been loaded, you can rasterize glyphs. When doing so, the primary font is first considered. If it does not have the requested glyph, the user configured fallback fonts (if any) are considered. If none of the user configured fallback fonts has the requested glyph, the FontConfig generated list of fallback fonts are checked.

The API is documented as man pages. These are built and installed when fcft is built as a standalone project, but not when built as a subproject.

Starting with 2.3.0, fcft gained the ability to do text shaping using HarfBuzz (an optional dependency). Initially, only individual grapheme clusters could be shaped. With 2.4.0, the ability to shape whole text-runs were added. It should be noted however, that fcft does not aim to compete with e.g. Pango, and that the text shaping support may not be (and perhaps never will be) sufficient for “professional” text layout.


Top: fcft_glyph_rasterize(), middle: fcft_grapheme_rasterize(), bottom: fcft_text_run_rasterize()


  • fontconfig
  • freetype
  • pixman
  • harfbuzz (optional, for grapheme and “run” shaping support)
  • libutf8proc (optional, for “run” shaping support)
  • tllist, unless built as a subproject


  • Supports all fonts loadable by FreeType2
  • Antialiasing
  • Subpixel antialiasing
  • Color bitmap fonts (emoji fonts)
  • Font caching
  • Glyph caching
  • Kerning1
  • Basic text shaping if compiled with HarfBuzz support

Not supported

  • Subpixel positioning

Remember, this is a simple library, not a full blown layout engine.

Projects using fcft


You can either install fcft as a system library, or use it as a meson subproject (assuming your project is meson based, of course).


If you install fcft as a system library, you can use pkg-config to get the compiler flags needed to find and link against fcft.


If your project is meson based, you can use fcft as a subproject. In your main project's meson.build, do something like:

fcft = subproject('fcft').get_variable('fcft')
executable('you-executable', ..., dependencies: [fcft])

Or, if fcft has been installed as a system library, a regular

fcft = dependency('fcft')

will suffice. Optionally, you can combine the two; search for a system library first, and fallback to a subproject:

fcft = dependency('fcft', version: '>=0.4.0', fallback: 'fcft')


Run-time dependencies:

  • fontconfig
  • freetype2
  • pixman
  • harfbuzz (optional, for text shaping support)
  • utf8proc2
  • wayland2
  • wayland-protocols2

Build dependencies:

  • Development packages of the run-time dependencies
  • meson
  • ninja
  • scdoc (optional, enabled automatically or disabled with -Ddocs=disabled)
  • tllist
  • check (optional, for unit tests)

For most users, this is typically enough:

meson build --buildtype=release
ninja -C build
ninja -C build test
sudo ninja -C build install

The tests require at least one latin font to be installed.

By default, fcft will be built with support for text-shaping if HarfBuzz is available. You can explicitly enable or disable this with the -Dtext-shaping=disabled|enabled|auto meson command line option.

If text-shaping is enabled, you might also want to enable the associated tests. Use -Dtest-text-shaping=true to do so. Note that these tests require an emoji font to be installed, and fc-match emoji must return that font first.

To build the example programs, use the -Dexamples=true meson command line option.


fcft is released under the MIT license.

fcft uses Unicode data files released under the Unicode, INC. License Agreement.

  1. only basic kerning supported (i.e. the old 'kern' tables, not the new 'GPOS' tables) ↩︎

  2. required by example programs ↩︎