Replies: 1 comment
-
This is an interesting idea and it would be nice to enable this use case somehow. I'm not sure that it would make sense to include in glyphon for now though (at least by default). There are some trade-offs for SDFs like the initial texture generation and artifacts depending on the SDF size/channels for multi-channel SDFs that we mostly avoid with the current method. Some of the other recent kinds of GPU rasterization ideas used in vello, use.gpu, slug (patented, so off-limits here), etc. would be interesting for avoiding some of the CPU-side rasterization that we currently need to do, but in practice I don't expect it to matter much for places that glyphon is currently being used. |
Beta Was this translation helpful? Give feedback.
-
Signed distance fields are an incredibly cool technique for text rendering:
https://www.youtube.com/watch?v=1b5hIMqz_wM
They allow you to render super crisp and clean text even with a single tiny texture.
And they also enable all sorts of other effects like controlling the thickness of the text, or creating outlines, or adjusting the sharpness of the text.
All of that is done with a single texture.
Because glyphon is already generating a texture from the fonts, it could easily use this technique: just generate a signed distance field texture from the font and use that for the GPU instead of an alpha mask.
This will enable those extra text effects, and also results in smaller and more efficient textures, while also producing much clearer and less pixelated results. And it means you can use a single texture for multiple font sizes.
And all of those benefits have no performance cost (aside from the one-time cost of generating the signed distance field texture). It's a win-win.
Beta Was this translation helpful? Give feedback.
All reactions