The height of a line or column doesn't change unless the font changes,
and we were already caching the line height. This patch extends it so
we also cache the column width.
When changing the font size, we now resize the terminal widget *before*
setting the font. This ensures that we keep the same logical terminal
size after the font change.
Instead of indicating which individual cards should be highlighted, card
games now indicate which stack is highlighted. This lets the stack draw
empty stacks with a highlight (e.g. the Foundation stack in Solitaire).
If the stack is non-empty, the stack can delegate highlighting to the
top-most card.
Currently, the outside of the card highlight has rounded corners, but
the inside has square corners. It looks a bit more polished if they are
both rounded.
Change column distribution to take in account is_length() and
is_percentage() width values instead of treating all cells like
they have auto width by implementing it in the way described
in CSS Tables 3 spec:
https://www.w3.org/TR/css-tables-3/#width-distribution-algorithm
distribute_width_to_column() is structured to follow schema:
w3.org/TR/css-tables-3/images/CSS-Tables-Column-Width-Assignment.svg
It is not possible to use width of containing block to resolve
cells width because by the time compute_table_measures() is
called row width is not known yet.
ThrowableStringBuilder is a thin wrapper around StringBuilder to map
results from the try_* methods to a throw completion. This will let us
try to throw on OOM conditions rather than just blowing up.
Without this, the "Widget not registered" error stays visible if the
widgets defined by the GML do not themselves fill with their background
color.
Also tidied up some unused includes.
For example, in Solitaire, when dragging a card around, it's common for
other implementations to highlight the card underneath the dragged card
if that other card is a valid drop target. This implementation will draw
a rounded rectangle within the edges of the highlighted card, using a
rudimentary complementary color of the board background color.
This adds the option to pass a subpixel offset when fetching a glyph
from a font, this offset is currently snapped to thirds of a pixel
(i.e. 0, 0.33, 0.66). This is then used when rasterizing the glyph,
which is then cached like usual.
Note that when using subpixel offsets you're trading a bit of space
for accuracy. With the current third of a pixel offsets you can end
up with up to 9 bitmaps per glyph.