Skip to content

Commit c6015f8

Browse files
committed
Enable HarfBuzz support in bundled FreeType
Due to the circular dependency between FreeType and HarfBuzz, this requires a small patch to make FreeType not look for HarfBuzz, allowing it to come from the superproject linkage. While FreeType does support dynamically loading HarfBuzz, this should be a bit safer at avoiding any chance of mixing system with bundled libraries.
1 parent bae2f91 commit c6015f8

File tree

3 files changed

+33
-1
lines changed

3 files changed

+33
-1
lines changed

extern/meson.build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ else
1515
'default_library=static',
1616
'brotli=disabled',
1717
'bzip2=disabled',
18-
'harfbuzz=disabled',
18+
get_option('system-libraqm') ? 'harfbuzz=disabled' : 'harfbuzz=static',
1919
'mmap=auto',
2020
'png=disabled',
2121
'tests=disabled',

subprojects/freetype2.wrap

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ source_fallback_url = https://downloads.sourceforge.net/project/freetype/freetyp
88
source_filename = freetype-2.14.1.tar.xz
99
source_hash = 32427e8c471ac095853212a37aef816c60b42052d4d9e48230bab3bdf2936ccc
1010

11+
# This patch allows using our bundled HarfBuzz.
12+
diff_files = freetype-2.14.1-static-harfbuzz.patch
13+
1114
[provide]
1215
freetype2 = freetype_dep
1316
freetype = freetype_dep
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
diff -uPNr freetype-2.14.1.orig/meson.build freetype-2.14.1/meson.build
2+
--- freetype-2.14.1.orig/meson.build 2025-09-11 07:12:24.000000000 -0400
3+
+++ freetype-2.14.1/meson.build 2026-01-04 15:49:14.198061441 -0500
4+
@@ -364,6 +364,13 @@
5+
endif
6+
endif
7+
8+
+if harfbuzz_opt == 'static'
9+
+ harfbuzz_dep = declare_dependency()
10+
+ harfbuzz_opt = 'YES'
11+
+ ftoption_command += ['--enable=FT_CONFIG_OPTION_USE_HARFBUZZ']
12+
+ ft2_deps += [harfbuzz_dep]
13+
+endif
14+
+
15+
if not harfbuzz_dep.found() and \
16+
(harfbuzz_opt == 'dynamic' or harfbuzz_opt == 'auto')
17+
# On Windows we don't need libdl, but on other platforms we need it.
18+
diff -uPNr freetype-2.14.1.orig/meson_options.txt freetype-2.14.1/meson_options.txt
19+
--- freetype-2.14.1.orig/meson_options.txt 2025-09-07 22:48:18.000000000 -0400
20+
+++ freetype-2.14.1/meson_options.txt 2026-01-04 15:49:30.087034418 -0500
21+
@@ -24,7 +24,7 @@
22+
23+
option('harfbuzz',
24+
type: 'combo',
25+
- choices: ['auto', 'enabled', 'dynamic', 'disabled'],
26+
+ choices: ['auto', 'enabled', 'dynamic', 'static', 'disabled'],
27+
value: 'auto',
28+
description: 'Use Harfbuzz library to improve auto-hinting;'
29+
+ ' if available, many glyphs not directly addressable'

0 commit comments

Comments
 (0)