This patch allows us to optionally output text in bold or italics (or both) when needed. It constructs these variations from the UI single font, using embolden for bold and obliquing (slanting) to simulate italics. The results aren't //quite// as good as if we use separate font files made specifically as bold or italic variations, but it is probably good enough for occasional emphasis:
{F8568712}
In order to do this there are some changes to our blf_glyph code to correct problems with our caching. Currently we have the parts in place that could cache nicely. A FontBLF has a listbase of caches and a pointer to the current one. And we can search for caches that match our intended use. But none of it is actually set right and we always just use the first cache. So in effect we only have caching the drawing of text while using a single size. Changes of size always rebuild the cache. This patch fixes that so that a font can properly cache glpyhs as they change in size or bold and italic state.
Note that I have not allowed the emboldening of fonts that are made to be bold. Nor will it oblique a font specifically made to be italic. So if you replace the UI font with some bold font you wouldn't get super-bold. Nor will an italic font show you over-italicized text.
Bold will add a bit of extra space to the glyph's advance, so slightly widening the character because of the widened features. But will not do so for fixed-pitch (monospaced) fonts, so they will still line up.
This patch slightly refactors some code in blf_glyph.c near the added code, but just to make that section a bit more readable.
In order to quickly see some changes, this patch makes some parts of tooltips bold. But this is not an actual proposed change, just a way to see the potential of this patch:
{F8568726}
To test this further you can just set the **existing** "bold" and "italic" boolean members of the uiFontStyle struct, that currently do nothing. Or if you are dealing with a FontBLF you can BLF_enable(font_id, BLF_BOLD), etc