solenum / msdf-c Goto Github PK
View Code? Open in Web Editor NEWPure C multi-channel signed distance field generator
License: MIT License
Pure C multi-channel signed distance field generator
License: MIT License
I've noticed that msdf-c generates some glyphs, mostly lower-case glyphs, with more space around the main character data than msdfgen provides.
Here are some examples. Glyphs generated from Roboto Regular at 32x32, a range of 1, and with autoframe.
Chars: a, @, h, c, -
I noticed the SDF images people were posting in issues seemed really broken, so I tried it out myself and sure enough got the same result. I was wondering how come the non-SDF output image was still OK, and I noticed that when you transfer msdf
to bitmap_sdf
, you convert negative values to unsigned integers (uint8_t
).
Bad | Good |
---|---|
Hey,
I'm using an almost identical version of main.c
but with the following changes:
char fontdefault[] = "hiragino-kaku-gothic-pron-w3.otf";
int size_sdf = 50;
int size_bitmap = 14;
char *c = "ใ";
char *out = "out.png";
char *fontf = fontdefault;
I tried setting size_sdf
to smaller values like 14
but the quality is still not too great:
Perhaps I'm doing something wrong. How can I improve the result?
Shouldn't this allocate contour_count+1
elements?
in msdf.c, line 910:
edge_segment_t *parts[3] = {};
edge_split(&contour_data[i].edges[0], parts[0], parts[1], parts[2]);
parts[3] are wild pointers.
fix:
edge_segment_t parts[3] = {0};
edge_split(&contour_data[i].edges[0], &parts[0], &parts[1], &parts[2]);
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.