diff options
| author | ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> | 2026-01-21 14:00:26 +0100 |
|---|---|---|
| committer | ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> | 2026-01-21 14:00:26 +0100 |
| commit | 14a5f705c8e3385a637be3377f0800b30c38e589 (patch) | |
| tree | c8199a77311468cec3cc7fc2e0b168e60b39a109 /src/Fl_win32.cxx | |
| parent | 2f7d7adfcf4bec55fa5e007947e4a455e85d8930 (diff) | |
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.
Diffstat (limited to 'src/Fl_win32.cxx')
| -rw-r--r-- | src/Fl_win32.cxx | 11 |
1 files changed, 0 insertions, 11 deletions
diff --git a/src/Fl_win32.cxx b/src/Fl_win32.cxx index a10339ab7..f0a489f22 100644 --- a/src/Fl_win32.cxx +++ b/src/Fl_win32.cxx @@ -1572,19 +1572,8 @@ static LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPar return 0; // and wait for next WM_CHAR message that will give the 2nd member } else { surrogate_pair[1] = u; // memorize the 2nd member of the pair - unsigned u32 = // convert surrogate pair to UTF-32 - 0x10000 + ((surrogate_pair[0] & 0x3ff) << 10) + (surrogate_pair[1] & 0x3ff); - if (u32 >= 0x1F3FB && u32 <= 0x1F3FF) { // emoji modifiers FITZPATRICK - Fl::e_length = 0; // skip them - return 0; - } Fl::e_length = fl_utf8fromwc(buffer, 1024, surrogate_pair, 2); // transform to UTF-8 } - } else if ( (u >= 0xFE00 && u <= 0xFE0F) // variation selectors - || u == 0x200D // zero-width joiner - ) { - Fl::e_length = 0; // skip these context-dependent Unicode points - return 0; } else { Fl::e_length = fl_utf8fromwc(buffer, 1024, &u, 1); // process regular Unicode point } |
