……
For FLTK text widgets to handle correctly these challenges, I have extended
to the Windows and macOS platforms the procedure already used under X11/Wayland
by function fl_draw(const char*, int):
On 1/21/26 07:09, Manolo wrote:
Hi fellow developers,[..]
some emojis are more complicated and created challenges to FLTK even though when the user selects one of them in the emoji palette nothing suggests this challenge.
One such case is for composed emojis where the desired drawn emoji is expressed in Unicode by 3 successive codepoints where the 2nd is U+200D "zero-width joiner".
[..]
Furthermore, it seems that some platforms add a 4th codepoint at the end [..] A unicode-compliant program should draw these 3 (or 4) consecutive codepoints as a single drawable character.
[..]
Another challenge occurs with how Unicode encodes skin color.
Now the question or request. In order to handle emojis with multiple
Unicode code points, are you are relying on libharfbuzz for the composition?
Currently, on my Vulkan text widget, I am just handling single Unicode
code points emojis with Freetype. You mentioned you modified fl_wdth. I
have that in place too, but is there a function in FLTK now to return
the actual composited glyph? Or do you rely on the OS functions with
libharfbuzz on Linux doing the composition?
I haven't looked at your commits, but I take it if a single emoji glyph can involve several, separate, utf8 sequences, I assume that while the OS handles font rendering, these details must impact our fl_utf8_xxx() functions so they know how to parse a "single character glyph" as multiple utf8 sequences, which must be quite tricky.
Hi fellow developers,
I'd like to explain here recent commits about emoji support by FLTK.
FLTK now supports the input of emojis to FLTK text widgets using the characterpalette each OS proposes to ease the task of identifying the desired emoji.I believe there's little doubt this is a good addition to FLTK considering
how popular emojis have become.
The emoji palette opens under macOS typing cmd+ctrl+space, under Windows with
Windows_key+dot, under Linux with Windows_key+dot+space.
$ od -a -t x1 emoji-wayland.txt
0000000 \ F 0 \ 9 F \ 9 0 \ B 1
5c 46 30 5c 39 46 5c 39 30 5c 42 31
Many emojis correspond to single Unicode points (example: 😄). FLTK adequately
draws them in text strings and edits these strings. In contrast,
some emojis are more complicated and created challenges to FLTK even though
when the user selects one of them in the emoji palette nothing suggests
this challenge.
One such case is for composed emojis where the desired drawn emoji is expressed
in Unicode by 3 successive codepoints where the 2nd is U+200D "zero-width joiner".
Example: the "woman pilot" emoji (👩✈️) is encoded by U+1F469 "woman" +
U+200D "zero-width joiner" + U+2708 "airplane". Furthermore, it seems that
some platforms add a 4th codepoint at the end: U+FE0F "emoji variation selector".
A unicode-compliant program should draw these 3 (or 4)
consecutive codepoints as a single drawable character.
Another challenge occurs with how Unicode encodes skin color.
Example: the "woman with dark skin" emoji (👩🏿) is encoded by U+1F469 "woman" +
U+1F3FF "emoji modifier fitzpatrick type 6".
For FLTK text widgets to handle correctly these challenges, I have extended
to the Windows and macOS platforms the procedure already used under X11/Wayland
by function fl_draw(const char*, int):
- the width of a string containing a single unicode point is computed and
memorized in the table of character widths;
- the width of a string containing several unicode points is computed as
such rather than as the sum of the widths of its composing characters.
The result is that FLTK text widgets now input and draw correctly also
complex emojis encoded with context-dependent codepoints, under all platforms.

--
You received this message because you are subscribed to the Google Groups "fltk.coredev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fltkcoredev...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/fltkcoredev/c7cc6911-af53-4284-9fb8-2dbdfb541b20%40aljus.de.
I would check if you can copy the cat icon from the X11 fltk app to the Wayland fltk app.
If that works try copying between two fltk Wayland apps.
It is possible the program with the "copy character" button is putting the wrong thing into the Wayland clipboard and this is not FLTK's fault.
./get_clipboard # shell script to read X11 and Wayland clipboard contents ----- wayland ----- *** wl-clipboard-types = text/plain # this type is offered, but ASCII only text/plain;charset=utf-8 # this type is what we should read (i.e. prefer) *wl* text/plain;charset=utf-8 = => 🦓 # this is what we want *wl* text/plain = # this is what we get w/o the patch => \F0\9F\A6\93There are also notable differences between my current Debian Bookwork system and my Debian Trixie VM. But anyway, the patch appears to work on both systems, but it's only a demo (fixing symptoms).
> In fact it is FLTK's fault because our Wayland implementation reads the wrong mime type from the clipboard.
Yes, that's right. After a false start, commit 84b5623 should do the right thing.
$ cat get_clipboard
#!/bin/bash
#
target() {
C="`xclip -o -t $1 2>&1`"
echo ""
echo "*x11* $1 ="
echo "=> '$C'"
}
get_all_targets() {
target "TARGETS"
target "text/plain;charset=utf-8"
target "UTF8_STRING"
target "text/plain"
target "STRING"
target "TEXT"
}
wl_get() {
echo ""
echo "*wl* $1 ="
echo "=> `wl-paste --type "$1" 2>/dev/null`"
}
wl_get_clipboard() {
# wl_get "TARGETS"
echo "*** wl-clipboard-types = `wl-paste -l`"
echo ""
wl_get "text/plain;charset=utf-8"
wl_get "UTF8_STRING"
wl_get "text/plain"
wl_get "STRING"
wl_get "TEXT"
}
echo ""
echo "----- x11 -----"
get_all_targets
echo ""
echo "----- wayland -----"
wl_get_clipboard
# end of file

- Should fl_utf8toa() also handle composed characters and return a
single character?
- Maybe it should be optional?
I think it turns utf8 characters into a ASCII characters or a space when it cannot be converted (ie. not Latin1).
I believe it can be also be used to measure the length of utf8 again for as it foreign characters were just ASCII.
BTW... have not looked at the implementation.
-- Gonzalo Garramuño ggar...@gmail.com
On 1/24/26 14:34, Manolo wrote:
Le samedi 24 janvier 2026 à 17:18:07 UTC+1, ggar...@gmail.com a écrit :
[..] fl_utf8toa() [..]
I don't understand at all the purpose of that function and what it does.
Offhand and without looking, I'd a guess it turns unicode chars
like á/à/â/ã/ä/å into just "a", useful for certain kinds of sorting,
or in contexts where pure ASCII is required, like domain names,
hostnames, and other pre-unicode contexts.
--
You received this message because you are subscribed to the Google Groups "fltk.coredev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fltkcoredev...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/fltkcoredev/d6b39d16-353d-431c-8902-187980192467n%40googlegroups.com.
Le lundi 26 janvier 2026 à 16:17:24 UTC+1, Albrecht-S a écrit :
…
> That said, these functions are probably no longer useful for FLTK (internally) and likely not for user programs as well. There is only one occurrence of fl_utf8toa() in test/utf8.cxx which can easily be removed/replaced by using UTF-8 encoding directly (I'm working on this).
> IMHO these two functions should be deprecated and eventually removed (in FLTK 1.6).
I support the suggestion to deprecate these 2 extremely old-fashioned functions.