Font fixes for various things #1703

Merged
9 commits merged into from Nov 7, 2012

4 participants

@jmarshallnz
Team Kodi member

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.

Jonathan Mar... added some commits Oct 31, 2012
Jonathan Marshall [fonts] make m_cellHeight actually reference the cell height, and hav…
…e the padded version be generated by a function
dbd786f
Jonathan Marshall [fonts] remove unused, local m_cellWidth variable d3b11cb
Jonathan Marshall [fonts] protect against accessing memory or textures outside of their…
… bounds - fixes #11015
3e3cad7
Jonathan Marshall [fonts] no need to clamp ch->offsetY at 0 now that the real culprit i…
…s found
1e2d14e
Jonathan Marshall [fonts] remove commented logging statement 590498e
Jonathan Marshall [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
6f229e9
Jonathan Marshall [fonts] rewrite the computations for m_cellHeight and m_cellBaseLine …
…so that they ensure no truncation takes place. Fixes #11855.
81e4c67
Jonathan Marshall [fonts] get rid of unused constant of 72/72 in font sizing calculations 158267e
Jonathan Marshall [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
a55c567
@ronie
Team Kodi member

thx!

i can confirm this fixes issue #11015

@ghost

i can't really comment much on the implementation, but if you put your balls on the table..

@ghost ghost merged commit f849887 into xbmc:master Nov 7, 2012
@Black09
Team Kodi member

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.

@jmarshallnz
Team Kodi member

They're already merged, as this the alignment one.

@Black09
Team Kodi member

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.

@jmarshallnz
Team Kodi member

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.

@Black09
Team Kodi member

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.

@HitcherUK

@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).

@Black09
Team Kodi member

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.

@HitcherUK

On further inspection all the textbox fonts are using <linespacing>...</linespacing>

Could this be the issue?

@jmarshallnz
Team Kodi member

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?

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment