Chlumsky / msdfgen

Multi-channel signed distance field generator
MIT License
3.9k stars 404 forks source link

Allow FT_LOAD_DEFAULT in import-font extension #172

Closed malytomas closed 1 year ago

malytomas commented 1 year ago

Would it be possible to add additional parameter to this function: https://github.com/Chlumsky/msdfgen/blob/7ff249bcd4da6678c5779d9664633c039fb50c0a/ext/import-font.cpp#L178 to allow replacing FT_LOAD_NO_SCALE with eg. FT_LOAD_DEFAULT?

This would allow me to set size for the font and use hinting (which is disabled with FT_LOAD_NO_SCALE). Hinting would make the text better readable for the particular size while still maintaining scalability of the msdf.

Chlumsky commented 1 year ago

How would it help with hinting when FreeType's rasterizer is not being used?

malytomas commented 1 year ago

Freetype applies hinting when loading the glyph, changing the outlines. It is not necessary to use the rasterizer for that.

malytomas commented 1 year ago

here is a comparison, all else equal.

no hinting: typo-without skins-without

with hinting: typo-with skins-with

where to focus:

please note, i am using just one msdf per font. the hinting allows making better msdf texture, which improves rendering irrespective of the final scale when rendering actual text.

Chlumsky commented 1 year ago

It seems that you have access to FT_Face since you can set the scale, so this should work for you: eeec8f2

malytomas commented 1 year ago

This works for me. Thank you.