From 05861ed6737f6b7b139895c4eeb26791edc333b4 Mon Sep 17 00:00:00 2001 From: Phil Jones Date: Wed, 8 Jun 2022 23:14:38 +0100 Subject: Add Harfbuzz backend. Another source of slow startup is initialising Pango. If the user supplies a ttf file, we can skip any Pango stuff and use Harfbuzz directly with Cairo to do our font rendering, providing a large speedup. --- meson.build | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'meson.build') diff --git a/meson.build b/meson.build index 06ce596..4b4b100 100644 --- a/meson.build +++ b/meson.build @@ -48,7 +48,7 @@ add_project_arguments( language: 'c' ) -sources = files( +common_sources = files( 'src/main.c', 'src/color.c', 'src/compgen.c', @@ -62,8 +62,14 @@ sources = files( 'src/xmalloc.c', ) +pango_sources = files('src/entry_backend/pango.c') +harfbuzz_sources = files('src/entry_backend/harfbuzz.c') + cc = meson.get_compiler('c') +libm = cc.find_library('m', required: false) +freetype = dependency('freetype2') glib = dependency('glib-2.0') +harfbuzz = dependency('harfbuzz') pangocairo = dependency('pangocairo') wayland_client = dependency('wayland-client') wayland_protocols = dependency('wayland-protocols', native: true) @@ -101,8 +107,16 @@ endforeach executable( 'tofi', - sources, wl_proto_src, wl_proto_headers, + common_sources, pango_sources, wl_proto_src, wl_proto_headers, dependencies: [glib, pangocairo, wayland_client, xkbcommon], + c_args: '-DUSE_PANGO', + install: true +) + +executable( + 'tofi-hb', + common_sources, harfbuzz_sources, wl_proto_src, wl_proto_headers, + dependencies: [libm, glib, freetype, harfbuzz, pangocairo, wayland_client, xkbcommon], install: true ) -- cgit v1.2.3