How to generate MSDF texture directly from FreeType FT_Outline? #241
Unanswered
ffbh123456
asked this question in
Q&A
Replies: 2 comments 4 replies
-
|
You can pretty much use the first example in the readme but you can skip the initialize / loadFont / destroy parts and instead of |
Beta Was this translation helpful? Give feedback.
0 replies
-
msdfgen::Shape shape{};
msdfgen::readFreetypeOutline(shape, &face->glyph->outline);
shape.normalize();
edgeColoringSimple(shape, 3.0);
msdfgen::SDFTransformation transformation(msdfgen::Projection(64.0, msdfgen::Vector2(0.125, 0.125)),
msdfgen::Range(0.125));
msdfgen::Bitmap<Float, 3> msdf(64, 64);
generateMSDF(msdf, shape, transformation);
MipData colors{};
colors.Reinitialize(msdf.width(), msdf.height());
for (Int i = 0; i < msdf.width(); ++i)
{
for (Int j = 0; j < msdf.height(); ++j)
{
Float r = msdf(i, j)[0];
Float g = msdf(i, j)[1];
Float b = msdf(i, j)[2];
colors.SetPixel(i, j, Color(r, g, b, 1));
}
}@Chlumsky |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment


Uh oh!
There was an error while loading. Please reload this page.
-
Hi, I am trying to generate MSDF glyphs directly from FreeType using msdfgen.
I load the glyph outline like this:
I would like to generate MSDF texture data directly from the FreeType outline.
Is there an example for it.
Beta Was this translation helpful? Give feedback.
All reactions