From 3d86ae9c708ecf19ee73dda50346925aab410751 Mon Sep 17 00:00:00 2001 From: David King Date: Wed, 15 Mar 2023 13:21:35 +0000 Subject: [PATCH] Fix missing glyphs in ft-font --- cairo-1.17.8-ft-font-missing-glyph.patch | 61 ++++++++++++++++++++++++ cairo.spec | 7 ++- 2 files changed, 67 insertions(+), 1 deletion(-) create mode 100644 cairo-1.17.8-ft-font-missing-glyph.patch diff --git a/cairo-1.17.8-ft-font-missing-glyph.patch b/cairo-1.17.8-ft-font-missing-glyph.patch new file mode 100644 index 0000000..5edcb59 --- /dev/null +++ b/cairo-1.17.8-ft-font-missing-glyph.patch @@ -0,0 +1,61 @@ +From 2766d9feeccd5d66e346b0abab38726b8e0aa1e9 Mon Sep 17 00:00:00 2001 +From: Adrian Johnson +Date: Tue, 7 Mar 2023 19:40:21 +1030 +Subject: [PATCH] ft: Use normal font size when detecting the format + +The format may depend on the font size. + +Fixes #643 +--- + src/cairo-ft-font.c | 17 ++++++++++++++++- + 1 file changed, 16 insertions(+), 1 deletion(-) + +diff --git a/src/cairo-ft-font.c b/src/cairo-ft-font.c +index 22a6a622b..89af6193d 100644 +--- a/src/cairo-ft-font.c ++++ b/src/cairo-ft-font.c +@@ -3314,11 +3314,13 @@ _cairo_ft_scaled_glyph_init_metrics (cairo_ft_scaled_font_t *scaled_font, + if (scaled_font->unscaled->have_color && scaled_font->base.options.color_mode != CAIRO_COLOR_MODE_NO_COLOR) + color_flag = FT_LOAD_COLOR; + #endif ++ /* Ensure use_em_size = FALSE as the format (bitmap or outline) ++ * may change with the size. */ + status = _cairo_ft_scaled_glyph_load_glyph (scaled_font, + scaled_glyph, + face, + load_flags | color_flag, +- !hint_metrics, ++ FALSE, + vertical_layout); + if (unlikely (status)) + return status; +@@ -3344,6 +3346,18 @@ _cairo_ft_scaled_glyph_init_metrics (cairo_ft_scaled_font_t *scaled_font, + glyph_priv->format = CAIRO_FT_GLYPH_TYPE_BITMAP; + } + ++ /* If hinting is off, load the glyph with font size set the the em size. */ ++ if (!hint_metrics) { ++ status = _cairo_ft_scaled_glyph_load_glyph (scaled_font, ++ scaled_glyph, ++ face, ++ load_flags | color_flag, ++ TRUE, ++ vertical_layout); ++ if (unlikely (status)) ++ return status; ++ } ++ + _cairo_ft_scaled_glyph_get_metrics (scaled_font, + face, + vertical_layout, +@@ -3369,6 +3383,7 @@ _cairo_ft_scaled_glyph_init_metrics (cairo_ft_scaled_font_t *scaled_font, + } + + if (glyph_priv->format == CAIRO_FT_GLYPH_TYPE_COLR_V1) { ++ /* Restore font size if previously loaded at em_size. */ + if (!hint_metrics) { + status = _cairo_ft_scaled_glyph_load_glyph (scaled_font, + scaled_glyph, +-- +GitLab + diff --git a/cairo.spec b/cairo.spec index 4359de6..6799cee 100644 --- a/cairo.spec +++ b/cairo.spec @@ -4,7 +4,7 @@ Name: cairo Version: 1.17.8 -Release: 2%{?dist} +Release: 3%{?dist} Summary: A 2D graphics library License: LGPL-2.1-only OR MPL-1.1 @@ -14,6 +14,8 @@ Source0: https://cairographics.org/snapshots/%{name}-%{version}.tar.xz Patch0: cairo-multilib.patch # https://gitlab.freedesktop.org/cairo/cairo/-/issues/634 Patch1: cairo-1.17.8-fix-tee-compilation.patch +# https://gitlab.freedesktop.org/cairo/cairo/-/merge_requests/467 +Patch2: cairo-1.17.8-ft-font-missing-glyph.patch BuildRequires: gcc BuildRequires: gcc-c++ @@ -158,6 +160,9 @@ This package contains tools for working with the cairo graphics library. %{_libdir}/cairo/ %changelog +* Wed Mar 15 2023 David King - 1.17.8-3 +- Fix missing glyphs in ft-font + * Sat Feb 25 2023 Marek Kasik - 1.17.8-2 - Rebuild for new freetype-2.13.0