This removes all legacy SDL1.2 code. It was done by invoking:
coan source --replace --no-transients -D"SDL_VERSION_ATLEAST(X, Y, Z)"=1 <file>
on each file.
This does the bare minimum to get the game compiling and running again with SDL 2. It fixes all of the compile errors, adds a missing seek operation to the SDL_RWops. The missing seek operation caused a NULL pointer dereference during game start.
This selects DejaVu Sans Mono instead of whatever sans serif font is the
default for the current locale is. I'm not entirely sure what to do to
handle non-Western European languages since this is intended to be used
for displaying code or debug info anyway.
Because I can't be bothered to figure out how the codepoint fallback
works for GUI1, I'm only adding support for using this with the
Pango/Cairo ttext wrapper, which is used by GUI2. I'm also leaving it up
to fontconfig to find the correct font file for the font when selected.
Hopefully this will suffice for now.
This commit permits link_color to be specified in any label defn,
at the same place that link_aware is specified. It will be passed
through to tcanvas and finally font::ttext in a similar manner as
link awareness, and used for the color parameter in any link
formatting. We choose a default value of #ffff00 everywhere,
matching the definition currently in the help browser for cross-
references.
If link awareness is enabled, then tokens that look like links
will be rendered thusly, and a "get_link" function is provided
to check if a layout location is pointing to a token which was
rendered as a link.
The get_token function, for a font::ttext, takes a coordinate
position and a list of delimiter characters, and returns the token
pointed to, if the position is in bounds, and the character being
pointed at is not itself a delimiter. Otherwise it returns the
empty string.
We also add some debugging output to the label click handler,
so that on log channel gui/event, we can see example tokens and
whether they look like URLs.
This is used implicitly in the "get_column_line" function but
sometimes you just want the index, for instance, if you want to
resolve whether a link was clicked on.
utils::wide_string was a std::vector<wchar_t>
On most unix systems, this is 32 bits wide, and therefore a UCS-4 encoding.
On windows however, wchar_t is 16 bits wide, and the naive approach results
in UCS-2, which can only represent the Basic Multilingual Plane.
Most functions that used wide_string have been moved over to ucs4_string.
The Win32 API has been moved over to a specially created utf16_string instead.
Specialty tolower #ifdefs have been removed, as the towlower function has
been available since OS X 10.3, OpenBSD 3.7 and probably ancient versions of
all other BSDs too. The only issue is that on windows, the function cannot
be applied to characters outside the BMP.
Bug #17220 was probably a side effect of the default argument of
ttext::set_maximum_height. So make the argument mandatory and change all
current callers to the old default value.
The number of characters per line can now be limited for a text object.
The limit is an approximation since the character width for a true type
font is not fixed. When this constrain is used, the text should also be
allowed to wrap.
Espreon noticed an ampersand in a campaign description breaks the
description markup. Now try to recover from unescaped ampersands. The
rest of the broken markup remains broken (pango seems to handle
unescaped single quotes and double quotes properly).
Now that widgets are not copyable, there's no need to have the ttext
class copyable. It might cause some problems, but those haven't been
confirmed yet.