Hi Jim, others, Thanks for your input. I've been meaning to get into the discussion as well but didn't get to.
I support your suggestions: generate from vector instead of bitmap, as well as 8-bit 3.5 fixed point or similar at least as an option. In your 3.5 fixed-point, does one unit reflect 1em, or 1 pixel at the SDF size? I think we do want a 8bit representation at least, and possible a higher one. On Wed, Jun 3, 2020 at 10:26 AM Jim Van Verth <jvanve...@google.com> wrote: > Forgive me for coming into this late -- a colleague pointed me to this > thread a couple of days ago and I'm just catching up. I work on Skia, and > we've been generating SDFs from glyphs for quite some time now, so the > possibility of just getting them from Freetype is pretty exciting. > > I hope you don't mind some comments on what we have now. We currently use > the Gustavson algorithm to generate them from bitmaps but it produces > slightly fuzzy results. I have wanted to move to use this algorithm to > generate them directly from the outline which might be useful to you: > > https://skia.googlesource.com/skia/+/refs/heads/master/src/gpu/GrDistanceFieldGenFromVector.cpp > We use it to store atlased paths at the moment and it produces much better > results. > > As far as format, we use an 8-bit 3.5 fixed point format, because it > allows us to combine the SDF and bitmap glyphs into the same atlas to > conserve space. There is a sacrifice in quality, but we only use the SDFs > for larger glyphs so it's acceptable. > > If you would like more details on our implementation please let me know. > I'm looking forward to seeing how this turns out. > > -- behdad http://behdad.org/