The [fonts] [font] WML was only used to set up SDL_ttf fonts. The engine
code to read it was left in after
2dfdc0061d in a dead state (some
structures are filled with data that never gets used).
This is a "it's known to be broken, so let's rip it out and put in a minimal
replacement" change. Updated raw pointers to smart pointers just because,
updated the docs a bit, and ended up with a big change.
Fixes the most visible part of #5194, where Chinese needed DroidSansFallbackFull
to be loaded before DroidSansJapanese. The removed code in
`char_block_map::insert` and `char_block_map::compress` had a bug that
triggered when one font had a contiguous range of codepoints that was a
superset of several ranges in another font - this meant it treated the first
font containing U+4E00 as having the whole CJK Unified Ideographs block.
Remove the now-unused font codepoints WML. There is no schema change for this,
it seems the data/hardwired/fonts.cfg file isn't checked by the validation.
Optimise calling set_font_list with the same list (but possibly reordered), by
reusing the already-loaded fonts.
This replaces the broken implementation I added in fb6c85e70b.
See documentation in data/hardwired/fonts.cfg for explanation as to why it didn't work and
why this does.
Currently "light" is set to Lato Light, which is weight 300. Regular is weight 400.
Since GUI1 widgets seem to rely on the given font size values in font.hpp
for their dimensions, those are unchanged. ThemeWML-provided sizes were adjusted,
and larger sizes assigned to elements that were too small with the new font.
Theme element rects were also adjusted as necessary.
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.
...since their ranges are overwritten by the shipped ones. In other
words, they will never be used if the new ones are in scope. This also
gets rid of a warning message.