From 14a5f705c8e3385a637be3377f0800b30c38e589 Mon Sep 17 00:00:00 2001 From: ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> Date: Wed, 21 Jan 2026 14:00:26 +0100 Subject: Improve handling of text containing context-dependent unicode points. This commit makes platforms Windows and macOS compute string widths with the same mechanism as what is in place for platforms Wayland/X11: - the width of a string containing a single codepoint is computed and memorized in the table of character widths; - the width of a string containing several codepoints is computed as such rather than as the sum of the widths of its composing characters. The result is that FLTK text widgets input and draw correctly also complex emojis encoded with context-dependent codepoints. Function fl_utf8_remove_context_dependent() is no longer necessary. --- src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'src/drivers/Wayland') diff --git a/src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx b/src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx index c9774f895..9199f3a5f 100644 --- a/src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx +++ b/src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx @@ -53,7 +53,6 @@ extern "C" { bool fl_is_surface_from_GTK_titlebar (struct wl_surface *surface, struct libdecor_frame *frame, bool *using_GTK); } -extern int fl_utf8_remove_context_dependent(char *text, int len); // set this to 1 for keyboard debug output, 0 for no debug output #define DEBUG_KEYBOARD 0 @@ -1017,10 +1016,7 @@ void text_input_commit_string(void *data, struct zwp_text_input_v3 *zwp_text_inp const char *text) { //printf("text_input_commit_string %s\n",text); free(pending_commit); - if (text) { - pending_commit = strdup(text); - fl_utf8_remove_context_dependent(pending_commit, strlen(pending_commit)); - } else pending_commit = NULL; + pending_commit = (text ? strdup(text) : NULL); } -- cgit v1.2.3