Typography icon indicating copy to clipboard operation
Typography copied to clipboard

Typography.MsdfGen lacks convenient shape generator from glyph

Open BreyerW opened this issue 5 years ago • 1 comments

Basically title. Without helper that would take glyph directly or just endpoints and glyph points and return shape Typography.MsdfGen is unusable at least for me.

BreyerW avatar Dec 20 '19 02:12 BreyerW

Hey, In case anyone else is interested, I've been working on a game engine and wanted to be able to generate SDFs at runtime and I managed to hook up the font loader and MsdfGen without any PixelFarm stuff. You can see my fork here on how it's done, but essentially I've created some wrappers around this libraries objects for my specific usecase.

TypefaceWrapper typeface = TypefaceWrapper.Load(new FileStream(...));
GlyphWrapper glyph = typeface.GetGlyph('&');
MsdfgenResult result = glyph.RenderMSDF(glyphSizePixels: 40, range: 10, paddingPixels: 3);
// Result contains the FloatRGBBmp object and a vector containing how much the glyph has been translated in pixels 

Tacodiva avatar Jun 30 '23 06:06 Tacodiva