Do not try to implement color glyphs without Pango help

Resolves: RHEL-842
This commit is contained in:
Carlos Garnacho 2023-12-07 17:54:32 +01:00
parent f4238e56da
commit fff119d5a3
2 changed files with 144 additions and 10 deletions

View File

@ -17,7 +17,7 @@
Name: gtk4
Version: 4.12.3
Release: 1%{?dist}
Release: 2%{?dist}
Summary: GTK graphical user interface library
License: LGPL-2.0-or-later
@ -220,6 +220,10 @@ desktop-file-validate %{buildroot}%{_datadir}/applications/*.desktop
%{_mandir}/man1/gtk4-widget-factory.1*
%changelog
* Thu Dec 07 2023 Carlos Garnacho <cgarnach@redhat.com> - 4.12.3-2
- Do not try to implement color glyphs without Pango help
Resolves: RHEL-842
* Thu Nov 30 2023 Carlos Garnacho <cgarnach@redhat.com> - 4.12.3-1
- Update to 4.12.3
Resolves: RHEL-842

View File

@ -1,7 +1,7 @@
From 5b85f27a19e96c6e39d24cf815e05d94c3de1133 Mon Sep 17 00:00:00 2001
From: Carlos Garnacho <carlosg@gnome.org>
Date: Wed, 29 Nov 2023 17:02:16 +0100
Subject: [PATCH 1/9] all: Drop usage of g_source_set_static_name()
Subject: [PATCH 01/10] all: Drop usage of g_source_set_static_name()
---
gdk/gdk.c | 2 +-
@ -258,7 +258,7 @@ index 12b025f317..e95fd95bfb 100644
From 6197d5dbfbc1a6cfbb66c423591a45b1e5f6402e Mon Sep 17 00:00:00 2001
From: Carlos Garnacho <carlosg@gnome.org>
Date: Wed, 29 Nov 2023 17:02:57 +0100
Subject: [PATCH 2/9] gsk: Add internal GtkPangoGlyphVisAttr struct
Subject: [PATCH 02/10] gsk: Add internal GtkPangoGlyphVisAttr struct
This struct has an is_color field.
---
@ -395,7 +395,7 @@ index 7f00437068..2c39447352 100644
From c0e1849b0c5e06ca648e6ed2d4731c269d872e6e Mon Sep 17 00:00:00 2001
From: Carlos Garnacho <carlosg@gnome.org>
Date: Wed, 29 Nov 2023 17:04:37 +0100
Subject: [PATCH 3/9] all: Avoid G_DEFINE_FINAL_TYPE
Subject: [PATCH 03/10] all: Avoid G_DEFINE_FINAL_TYPE
---
gtk/gtkfilethumbnail.c | 2 +-
@ -435,7 +435,7 @@ index d99b16c33b..c1859644fc 100644
From c380212c74569ba6ff63e8b605a03d68ab26e69c Mon Sep 17 00:00:00 2001
From: Carlos Garnacho <carlosg@gnome.org>
Date: Wed, 29 Nov 2023 17:05:12 +0100
Subject: [PATCH 4/9] gtk: Add internal GtkSignalGroup
Subject: [PATCH 04/10] gtk: Add internal GtkSignalGroup
Copied from GSignalGroup at newer GLib
---
@ -1355,7 +1355,7 @@ index 1bc3ab14e6..20ac76844a 100644
From 5db21b2df160d11cc89b65f0acf6e8e5d7328413 Mon Sep 17 00:00:00 2001
From: Carlos Garnacho <carlosg@gnome.org>
Date: Wed, 29 Nov 2023 17:12:20 +0100
Subject: [PATCH 5/9] testsuite: Avoid G_TEST_SUBPROCESS_DEFAULT
Subject: [PATCH 05/10] testsuite: Avoid G_TEST_SUBPROCESS_DEFAULT
---
testsuite/gdk/display.c | 2 +-
@ -1381,7 +1381,7 @@ index 16be96db63..3e285aaa75 100644
From b8bb55fa2946da52d2ec233ce4e512299b240fa3 Mon Sep 17 00:00:00 2001
From: Carlos Garnacho <carlosg@gnome.org>
Date: Wed, 29 Nov 2023 17:16:05 +0100
Subject: [PATCH 6/9] demos: Do not demo unsupported pango features
Subject: [PATCH 06/10] demos: Do not demo unsupported pango features
---
demos/gtk-demo/fontify.c | 27 ---------------------------
@ -1454,7 +1454,7 @@ index 96c2300ac8..afba8a53a6 100644
From 0eea3d49ffdd673ef6d09264c76478e27b121899 Mon Sep 17 00:00:00 2001
From: Carlos Garnacho <carlosg@gnome.org>
Date: Wed, 29 Nov 2023 17:49:55 +0100
Subject: [PATCH 7/9] gtk: Avoid g_set_str()
Subject: [PATCH 07/10] gtk: Avoid g_set_str()
---
gtk/gtkcolumnviewrow.c | 10 ++++++++--
@ -1612,7 +1612,7 @@ index bb07c1f832..3f4c8597a2 100644
From 3c4027a438437502f057684cccaf335800011876 Mon Sep 17 00:00:00 2001
From: Carlos Garnacho <carlosg@gnome.org>
Date: Wed, 29 Nov 2023 20:44:54 +0100
Subject: [PATCH 8/9] gtk: Port back to old pango API
Subject: [PATCH 08/10] gtk: Port back to old pango API
---
demos/gtk-demo/font_features.c | 8 -
@ -3106,7 +3106,7 @@ index 15de3d4d23..3184e8ca8a 100644
From 62228a63c461485688642acae46a57a38994aff2 Mon Sep 17 00:00:00 2001
From: Carlos Garnacho <carlosg@gnome.org>
Date: Wed, 29 Nov 2023 20:45:32 +0100
Subject: [PATCH 9/9] build: Decrease pango/glib version
Subject: [PATCH 09/10] build: Decrease pango/glib version
---
meson.build | 6 +++---
@ -3132,3 +3132,133 @@ index 998f4c08f2..a3ce04ce70 100644
--
2.43.0
From 64a07ed871fd99ea1f40204eedba6dff96ac7ad4 Mon Sep 17 00:00:00 2001
From: Carlos Garnacho <carlosg@gnome.org>
Date: Thu, 7 Dec 2023 17:50:56 +0100
Subject: [PATCH 10/10] Fixups
---
gsk/gl/gskglrenderjob.c | 9 +--------
gsk/gskrendernodeimpl.c | 6 ++----
gsk/gskrendernodeparser.c | 11 +++--------
gtk/gtkpango.c | 2 ++
4 files changed, 8 insertions(+), 20 deletions(-)
diff --git a/gsk/gl/gskglrenderjob.c b/gsk/gl/gskglrenderjob.c
index 1a3cea3e90..a75917968e 100644
--- a/gsk/gl/gskglrenderjob.c
+++ b/gsk/gl/gskglrenderjob.c
@@ -2980,7 +2980,6 @@ gsk_gl_render_job_visit_text_node (GskGLRenderJob *job,
guint last_texture = 0;
GskGLDrawVertex *vertices;
guint used = 0;
- guint16 nc[4] = { FP16_MINUS_ONE, FP16_MINUS_ONE, FP16_MINUS_ONE, FP16_MINUS_ONE };
guint16 cc[4];
const guint16 *c;
const PangoGlyphInfo *gi;
@@ -3019,13 +3018,7 @@ gsk_gl_render_job_visit_text_node (GskGLRenderJob *job,
lookup.glyph = gi->glyph;
- /* If the glyph has color, we don't need to recolor anything.
- * We tell the shader by setting the color to vec4(-1).
- */
- if (!force_color && ((GtkPangoGlyphVisAttr*) &gi->attr)->is_color)
- c = nc;
- else
- c = cc;
+ c = cc;
cx = (float)(x_position + gi->geometry.x_offset) / PANGO_SCALE;
lookup.xshift = compute_phase_and_pos (x + cx, &cx);
diff --git a/gsk/gskrendernodeimpl.c b/gsk/gskrendernodeimpl.c
index d0043b08e6..90c9401194 100644
--- a/gsk/gskrendernodeimpl.c
+++ b/gsk/gskrendernodeimpl.c
@@ -5105,8 +5105,7 @@ gsk_text_node_diff (GskRenderNode *node1,
info1->geometry.width == info2->geometry.width &&
info1->geometry.x_offset == info2->geometry.x_offset &&
info1->geometry.y_offset == info2->geometry.y_offset &&
- info1->attr.is_cluster_start == info2->attr.is_cluster_start &&
- ((GtkPangoGlyphVisAttr*) &info1->attr)->is_color == ((GtkPangoGlyphVisAttr*) &info2->attr)->is_color)
+ info1->attr.is_cluster_start == info2->attr.is_cluster_start)
continue;
gsk_render_node_diff_impossible (node1, node2, region);
@@ -5185,8 +5184,7 @@ gsk_text_node_new (PangoFont *font,
glyph_infos[n] = glyphs->glyphs[i];
- if (((GtkPangoGlyphVisAttr*) &glyphs->glyphs[i].attr)->is_color)
- self->has_color_glyphs = TRUE;
+ self->has_color_glyphs = FALSE;
n++;
}
diff --git a/gsk/gskrendernodeparser.c b/gsk/gskrendernodeparser.c
index 2c39447352..41edc8bcff 100644
--- a/gsk/gskrendernodeparser.c
+++ b/gsk/gskrendernodeparser.c
@@ -1014,9 +1014,8 @@ parse_glyphs (GtkCssParser *parser,
gi.attr.is_cluster_start = 1;
if (gtk_css_parser_try_ident (parser, "color"))
- ((GtkPangoGlyphVisAttr*) &gi.attr)->is_color = 1;
- else
- ((GtkPangoGlyphVisAttr*) &gi.attr)->is_color = 0;
+ {
+ }
}
pango_glyph_string_set_size (glyph_string, glyph_string->num_glyphs + 1);
@@ -2979,8 +2978,7 @@ gsk_text_node_serialize_glyphs (GskRenderNode *node,
glyphs[i].geometry.width == ascii->glyphs[j].geometry.width &&
glyphs[i].geometry.x_offset == 0 &&
glyphs[i].geometry.y_offset == 0 &&
- glyphs[i].attr.is_cluster_start &&
- !((GtkPangoGlyphVisAttr*) &glyphs[i].attr)->is_color)
+ glyphs[i].attr.is_cluster_start)
{
switch (j + MIN_ASCII_GLYPH)
{
@@ -3010,7 +3008,6 @@ gsk_text_node_serialize_glyphs (GskRenderNode *node,
g_string_append_printf (p, "%u ", glyphs[i].glyph);
string_append_double (p, (double) glyphs[i].geometry.width / PANGO_SCALE);
if (!glyphs[i].attr.is_cluster_start ||
- ((GtkPangoGlyphVisAttr*) &glyphs[i].attr)->is_color ||
glyphs[i].geometry.x_offset != 0 ||
glyphs[i].geometry.y_offset != 0)
{
@@ -3020,8 +3017,6 @@ gsk_text_node_serialize_glyphs (GskRenderNode *node,
string_append_double (p, (double) glyphs[i].geometry.y_offset / PANGO_SCALE);
if (!glyphs[i].attr.is_cluster_start)
g_string_append (p, " same-cluster");
- if (((GtkPangoGlyphVisAttr*) &glyphs[i].attr)->is_color)
- g_string_append (p, " color");
}
if (i + 1 < n_glyphs)
diff --git a/gtk/gtkpango.c b/gtk/gtkpango.c
index 69d96b43a1..e85d2efd26 100644
--- a/gtk/gtkpango.c
+++ b/gtk/gtkpango.c
@@ -510,6 +510,7 @@ append_enum_value (GString *str,
g_string_append_printf (str, " %d", value);
}
+#if !PANGO_VERSION_CHECK(1, 50, 0)
static PangoAttrInt *
pango_attribute_as_int (PangoAttribute *attr)
{
@@ -647,6 +648,7 @@ pango_attribute_as_shape (PangoAttribute *attr)
return NULL;
}
}
+#endif
static void
attr_print (GString *str,
--
2.43.0