From 6175e719d582532c59371f90b8ec4e9c9b9ce86d Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Fri, 28 Mar 2025 10:01:48 +0100 Subject: [PATCH] Require HarfBuzz 2.6.5. Remove ifdef's for HarfBuzz 2.6.5 (instead of forward porting fix for PDF font crash !7070). AppImage for 1.4.x uses 2.6.4 while in master the AppImage uses 8.3.0. Note, adding color font support for all color font types will require HarfBuzz 7.0. --- CMakeScripts/DefineDependsandFlags.cmake | 2 +- src/libnrtype/font-instance.cpp | 14 ++------------ 2 files changed, 3 insertions(+), 13 deletions(-) diff --git a/CMakeScripts/DefineDependsandFlags.cmake b/CMakeScripts/DefineDependsandFlags.cmake index 0425307d62..81cc8514aa 100644 --- a/CMakeScripts/DefineDependsandFlags.cmake +++ b/CMakeScripts/DefineDependsandFlags.cmake @@ -124,7 +124,7 @@ endif() find_package(PkgConfig REQUIRED) pkg_check_modules(INKSCAPE_DEP REQUIRED - harfbuzz + harfbuzz>=2.6.5 pangocairo>=1.44 pangoft2 fontconfig diff --git a/src/libnrtype/font-instance.cpp b/src/libnrtype/font-instance.cpp index c6e4091c28..195566c412 100644 --- a/src/libnrtype/font-instance.cpp +++ b/src/libnrtype/font-instance.cpp @@ -158,16 +158,11 @@ void FontInstance::acquire(PangoFont *p_font_, PangoFontDescription *descr_) } hb_face = hb_font_get_face(hb_font); -#if HB_VERSION_ATLEAST(2,6,5) // hb_font is immutable, yet we need to act on it (with set_funcs) to extract the freetype face hb_font_copy = hb_font_create_sub_font(hb_font); hb_ft_font_set_funcs(hb_font_copy); face = hb_ft_font_lock_face(hb_font_copy); -#else - if (face) { - pango_fc_font_unlock_face(PANGO_FC_FONT(p_font)); - } -#endif + if (!face) { release(); throw CtorException("Failed to get freetype face"); @@ -177,18 +172,13 @@ void FontInstance::acquire(PangoFont *p_font_, PangoFontDescription *descr_) // Release the resources acquired by acquire(). void FontInstance::release() { -#if HB_VERSION_ATLEAST(2,6,5) if (hb_font_copy) { if (face) { hb_ft_font_unlock_face(hb_font_copy); } hb_font_destroy(hb_font_copy); } -#else - if (face) { - pango_fc_font_unlock_face(PANGO_FC_FONT(p_font)); - } -#endif + pango_font_description_free(descr); g_object_unref(p_font); } -- GitLab