add SDF support when using stb_truetype backend#38
add SDF support when using stb_truetype backend#38wheybags wants to merge 1 commit intomemononen:masterfrom
Conversation
aa13118 to
34cf562
Compare
|
@memononen bump? |
src/fontstash.h
Outdated
| float pixelDistScale; // what value the SDF should increase by when moving one SDF "pixel" away from the edge (on the 0..255 scale) | ||
| // if positive, > onedge_value is inside; if negative, < onedge_value is inside | ||
| }; | ||
| typedef struct FONSsdfSettings; |
There was a problem hiding this comment.
This should be:
typedef struct FONSsdfSettings FONSsdfSettings;
src/fontstash.h
Outdated
| { | ||
| FONSsdfSettings sdfSettings; | ||
| memset(&sdfSettings, 0, sizeof(FONSsdfSettings)); | ||
| sdfSettings.sdfEnabled = false; |
There was a problem hiding this comment.
Had to change false to 0 to build with C
src/fontstash.h
Outdated
| { | ||
| FONSsdfSettings sdfSettings; | ||
| memset(&sdfSettings, 0, sizeof(FONSsdfSettings)); | ||
| sdfSettings.sdfEnabled = false; |
There was a problem hiding this comment.
Had to change false to 0 to build with C
|
Seemed to work after those changes. Would be very nice to have this |
|
fixed |
|
👍 would be nice to have this upstream! |
|
@wheybags also it would be super useful to be able to provide two different text sizes: one for glyph size under SDF font and another for actual text size. Because SDF fonts don't really work that well under small pt sizes. |
|
@jimon What I do is pass in a constant value to fonstash (30px), and then scale the font metrics I get back according to the difference between the constant and the actual size. |
uses the builtin sdf generation in stb_truetype, disabled when using freetype