From ac482565142ad7dca712d00f89da08f57d6733c7 Mon Sep 17 00:00:00 2001 From: Thomas Lange Date: Mon, 21 Oct 2024 18:33:47 +0200 Subject: [PATCH] gtkui: Hide info area text containing emoji properly. Closes: #1491 Fading out text with emoji characters can lead to them still being displayed above the text of a new track. Ignoring zero alpha channels avoids this. Reproduced on Ubuntu 24.04. Arch Linux requires "noto-fonts-emoji". --- src/gtkui/ui_infoarea.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/gtkui/ui_infoarea.cc b/src/gtkui/ui_infoarea.cc index 109291312..25da5d4f3 100644 --- a/src/gtkui/ui_infoarea.cc +++ b/src/gtkui/ui_infoarea.cc @@ -143,6 +143,12 @@ G_GNUC_END_IGNORE_DEPRECATIONS static void draw_text (GtkWidget * widget, cairo_t * cr, int x, int y, int width, float r, float g, float b, float a, int font_size, const char * text) { + /* The visibility of Unicode characters like emoji is not affected by the + * alpha channel. Make sure to hide them when fading-out track information. + * See also: #1491 */ + if (a <= 0) + return; + cairo_move_to (cr, x, y); cairo_set_source_rgba (cr, r, g, b, a);