Typogenic
Typogenic copied to clipboard
Fix undersized glyph bounding boxes for click support
The removed line of code doesn't actually prevent unclickable dead zones, but it DOES sometimes lead to the generated per-glyph bounding boxes used for click support to be too small (the demo's Arial letter 'j' is a good example.) This should alleviate the third problem discussed in #11.
Works for me, although one thing that probably does need to happen there instead of the removed line is
r.width += Tracking;
to extend each glyph's click bounds out to cover the space between glyphs if character spacing / tracking is set to > 0 (actually removing the resulting unclickable dead zones within words), and also reduce the degree of bounds overlap if tracking is < 0.
For the xAdvance logic I could have just been working with some screwy font data previously or something but I'll see what I can dig up later.
Adding the tracking makes a lot of sense to me -- I'll try it to make sure it doesn't do anything unexpected and amend this PR.
Yeah, not too sure what the xAdvance stuff would have been doing previously -- I can try it with a few alternate fonts to double-check that it's not correcting wonky behaviour under different circumstances.
Hey guys, sorry I've been quite busy these days so I'm just getting up to speed here and I unfortunately don't have much time to test this one extensively, but as @gnustoboz noted, how does it work with Tracking != 0
?