astiopin / sdf_atlas

SDF font atlas generation tool

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Doubts on internal scaling

DanielHerchenbach opened this issue · comments

In the function "load_ttf_mem" a factor
float scale = 1.0f / em_ascent;
is applied.
I think it is missing for glyphs that have left side bearing only and
glyphs[ iglyph + num_glyphs ].left_side_bearing = ttf_i16( pos );
should be changed to
glyphs[ iglyph + num_glyphs ].left_side_bearing = ttf_i16( pos ) * scale;

Apart from that, I doubt that this factor is necessary in the first place. Setting it to one gave me the same export.