Handmade Hero»Forums»Code
Mike T
27 posts
Day 173: Spaces 0 width
Edited by Mike T on
Somewhere around 35minutes in the width of spaces got changed to 0. You can see this most easily in the last line of text.

The HorizontalAdvance array was changed to be initialized to 0 and the advance calculation was moved into LoadGlyphBitmap().

But it was moved inside the "if (MinX <= MaxX)" check and for spaces all the pixels are black so MinX will be less than MaxX. So the HorizontalAdvance does not get updated.
Casey Muratori
801 posts / 1 project
Casey Muratori is a programmer at Molly Rocket on the game 1935 and is the host of the educational programming series Handmade Hero.
Day 173: Spaces 0 width
Thanks for the catch! We fixed it on day 174 when someone (you?) who had read this post mentioned it on the stream.

- Casey
Mike T
27 posts
Day 173: Spaces 0 width
It was someone else, I was around but sadly I was working and only half there. I will watch the episode properly today. From what I caught of it there was slightly more to the fix than what I wrote.
Casey Muratori
801 posts / 1 project
Casey Muratori is a programmer at Molly Rocket on the game 1935 and is the host of the educational programming series Handmade Hero.
Day 173: Spaces 0 width
No, I don't think so - the fix is exactly what you wrote (modulo the fact that you have to add space to the character set, too). But not having read the post, I didn't remember the Min/Max thing, so I thought the fix was just adding space to the character set. Then I was like "WTF???" and then looked at the glyph code and noticed the Min/Max thing and was like "oh right, space won't be processed still" and then moved the kerning stuff outside.

- Casey