- Avoids creating tons of external files
- Suppresses the startup banner to reduce extraneous messages
- Makes the system work on Windows
- Fixes an issue of batched tests being misnamed if one of them is an error
We need to obtain the text extents prior to rendering regardless. In the
best case, we do so in advance before rendering, which internally
doesn't recalculate the text layout if the rendering parameters haven't
been touched in the meantime. In the worst case, we calculate extents
twice but only render once.
The corrections applied in calculate_probability_of_debuff() are already taken into account in the main attack outcome calculation for being slowed. They do not need to be applied again, that only needs to be done for being poisoned. Doing this for being slowed also can cause an assert, such as the one reported in issue #5533 (and probably also the one in issue #5002).
Fixes#5533
First cause of breakage seems to be that the introduction of color_t
changed the size of the colour components from something longer than 8
bits to 8 bits, resulting in stringstream outputting invalid UTF-8. The
second cause is the dropping of GUI1 markup along with SDL_ttf.
This functionality is entirely unused in 1.14 and later because GUI1
menus aren't used to list units anymore.
(Strictly speaking, all sorters are unused right now.)
This removes the build-time dependencies on SDL_ttf and FriBidi,
alongside the SDL_ttf wrappers, the SDL_ttf text surface class, the
SDL_ttf render cache, and the SDL_ttf (de)initialization code.
A few caveats:
* This implementation allows configuring the font family class and
style to select the correct font for any given context. The default
values are equivalent to what was being done in the SDL_ttf-based
version, but not future-proof. Users like the GUI2 textbox should
make use of the new optional parameters to select a more relevant
font going forward (not part of this commit).
* Pango has a line height metric, equivalent to SDL_ttf's
TTF_FontLineSkip(). However, this is not what we want here -- the
ascender + descender formula is intended to give us a neat box where
the tallest glyph can fit, not the minimum distance between
baselines. This is important for the GUI2 textbox in particular.
* The internal implementation uses the default text renderer and sets
relevant parameters. This should not introduce new issues, but if it
does then that means someone is not resetting the renderer properly
before using it.
This notably rids GUI2 of its one known dependency on SDL_ttf.
This lets Pango do all of the work for us and pulls the text back from
the renderer. It shouldn't be much more expensive than it needs to be --
the only real expensive step is copying the characters back into a list
of strings, and it's not by much.
Note: I haven't quite figured out what the partial_line parameter does
or what to do about it. It's probably not trivial to implement since it
seems to involve the decision of whether to break a line within word
boundaries or not.
This adds a minimal wrapper around pango_text intended for use in GUI1,
in particular for the help browser. Functionality is very incomplete
right now but for the time being we can render text, determine line
dimensions, and ellipsize text, which is almost the bare minimum needed
for porting the Help system (it's still missing a word wrapping
implementation).