The primary intention of this is to fix #11015, an issue where a font is just the right size that it defies our (lack of) checking for texture bounds, leading to DirectX not doing the transfer of a letter to the texture. GL would have had issues as well, involving writing to memory that (potentially) doesn't exist.
The secondary intention is to fix #10549, where we don't align outlined fonts correctly, thus causing the border texture to be incorrect for some characters. In fixing this, we must align the baselines between fonts, which essentially means a slight change in vertical alignment for all labels that don't align centrally. From a quick look at a couple of skins I didn't notice anything out of place, but skinners should look more careful (basically any label control that isn't centered vertically).
EDIT: Also fixes #11855.
Lastly, there's various cleanups to make the code (hopefully) clearer to others.
[fonts] make m_cellHeight actually reference the cell height, and hav…
…e the padded version be generated by a function
[fonts] remove unused, local m_cellWidth variable
[fonts] protect against accessing memory or textures outside of their…
… bounds - fixes #11015
[fonts] no need to clamp ch->offsetY at 0 now that the real culprit i…
[fonts] remove commented logging statement
[fonts] always offset by the border size, so that we get correct alig…
…nment of font and bordered font in the cases where the border has a hight ascender. Closes #10549
[fonts] rewrite the computations for m_cellHeight and m_cellBaseLine …
…so that they ensure no truncation takes place. Fixes #11855.
[fonts] get rid of unused constant of 72/72 in font sizing calculations
[fonts] make the space between characters in the texture a static con…
…stant and reduce the gap vertically now that the truncation issues have been fixed
i can confirm this fixes issue #11015
i can't really comment much on the implementation, but if you put your balls on the table..
Any chance that this could be post-Frodo? Otherwise I would have to fix the vertical alignment in almost every label in my skin. A proper fix for correct center alignment for every font would also be ok but I guess that's tricky.
They're already merged, as this the alignment one.
All my (vertically) centered labels have a different alignment now, 1 or 2px different as before this fix. Is that intended? Because it is a lot of work to fix everything now.
No vertically centered labels should have changed by more than a single pixel (due to rounding). It is intended as before the font height was incorrectly rounded to smaller than it should be.
Ok, I made another test and it seems fine now with your fix... I corrected the valign of my font and everything is perfect now, thanks.
@jmarshallnz As well as making all my centrally aligned labels 1 pixel off it's really messed up my textboxes (anything from 6 to 30 pixels off depending on font size).
jmarshall is correct that the font height was calculated smaller than it's real height before so the font was aligned 1px wrong in most cases, I did some testing yesterday. If it's now wrongly aligned, the font is the problem.
On further inspection all the textbox fonts are using <linespacing>...</linespacing>
Could this be the issue?
The lineheight wasn't altered at all. @HitcherUK mind posting in the forums what the issue is with which skin so I can take a look?