The issue occurs when drawing text with cairo+pango at some sizes (11 is one of them).
It affects both FLTK text widgets, so it's not fluid-specific.
It affects both Wayland and X11 when using Cairo+Pango.
No issue with X11+Pango-Cairo.
No issue with X11+Xft.
Thanks to @wcout for suggesting this fix.
Codex assisted code review limited to documentation related
issues with the Fl_Terminal widget.
Most fixes grammatical, typos, and and other common human error
stuff. A few code changes where the docs were correct but the
implementation was wrong.
Generally, I think these mods would be safe to backport to 1.4.x
(if that's within the scope of 1.4.x), as these aren't features
or behavioral changes, but outright misleading documentation,
or implementations incorrect wrt the docs.
Codex suggested replacement for old fl_utf8len() which includes
more strict RFC 3629 validation checks. This helps the test/terminal
program detect and show UTF-8 parsing errors.
Avoid re-encoding valid UTF-8 characters. Only *invalid* characters
need to be encoded, valid characters are moved.
Increase size of intermediate UTF-8 character buffer from 4 to 6 bytes
to prevent potential overflow.
Benign: make `use_priv_buffer` bool.
Some of these changes were suggested by AI.
The buffer returned by realloc can start at a different address, causing
all previous pointers to become stale. Instead of using the pointer q to
the current location in the reallocated buffer, use just an offset so we
always point to the correct place with utf8_buffer + q.
Similarly, we get rid of retval and keep track of the private buffer
usage and first call using the explicit flag use_priv_buffer.
We also avoid increasing the buffer by N + 1000 (doubling it each time)
and only do increments of 1000 bytes.
Codex double-checked my work.
This improves ANSI/XTERM parsing error detection, and also handles
detecting bad UTF-8 sequences better by testing for negative returns
from fl_utf8len().
I'd lost track of these changes for several years due to a workstation
outage, delaying my solution for #950.
Part 1: the new file FL/win32_target.h simplifies setting minimal
Windows version macros to support building with minimal Windows
version symbols, such as for Windows 2000 or Windows 8, rather
than hardcoding weird C/C++ macro code to define the symbols.
Part 2: apply this everywhere where WINVER and _WIN32_WINNT needed
to be set manually.
Part 3: fix pen support builds on Windows by setting the correct
minimal Windows version in the concerned source files.
Part 4: fix CMake compilation test for pen support: use a symbol
that's really used in the sources.