News for hackers. Stuff that matters.
Re:HarfBuzz Slug Support with WebGL by eviks on Saturday April 04, 2026 @12:58AM (#47635916)
Are there good explanations/demos comparing this to msdf?
Re:HarfBuzz Slug Support with WebGL by behdad on Monday April 06, 2026 @07:54PM (#47668965)
msdf still suffers from detail loss at large sizes, which this method doesn't have.
Re:HarfBuzz Slug Support with WebGL by eviks on Monday April 06, 2026 @09:30PM (#47669672)
Thanks, how large of a size? And at lower sizes, what's the performance/quality like? Is this the silver bullet?
Re:HarfBuzz Slug Support with WebGL by amitp on Saturday April 11, 2026 @02:21PM (#47732806)
Slug preserves the vector shapes. MSDF first converts to a texture, which can lose small details. How much depends on the size of your texture and the complexity of the font. I expect MSDF will never look better than Slug.

However, MSDF can handle lots of distance-based effects (glow, shadow, outline, gradient, etc.)[1], and I don't think Slug does that. And MSDF is constant time whereas (I think) Slug is going to vary depending on the complexity of the font.

The Slug paper [2] says:

  All of the techniques that store data in a texture atlas are inherently using a discrete
  sampling of what is actually an infinitely precise description of a glyph outline. This
  inescapably leads to limitations that can be mitigated by increasing the resolution of
  the texture atlas, but that can never be completely removed. For applications that
  need to render a wide range of characters at potentially large font sizes, a texture atlas
  capable of producing glyphs at an acceptable level of quality may have prohibitively
  large storage requirements.
[1] https://www.redblobgames.com/articles/sdf-fonts/#demo

[2] https://jcgt.org/published/0006/02/02/