grimfang4 / SDL_FontCache

A generic font caching C library with loading and rendering support for SDL.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

vertical spacing between lines is not scaled when rendering text with scaling

waterimp opened this issue · comments

When I render text using FC_DrawColumnEffect(), I like to set effect.scale.x and effect.scale.y. When I make effect.scale.y larger (say 2.0 or 3.0), I notice that the lines between my text get smushed together too closely. When I make effect.scale.y smaller than 1 (say 0.5), the lines are unusually far apart.

I have traced the problem to here in FC_DrawColumnFromBuffer(), which does not take into account scale when determining where next line starts from, but just the unscaled line height:

    y += FC_GetLineHeight(font);

I have a one-line PR coming in a minute that fixes this issue.