-
Notifications
You must be signed in to change notification settings - Fork 88
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add SDF support when using stb_truetype backend #38
base: master
Are you sure you want to change the base?
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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