alexheretic / glyph-brush

Fast GPU cached text rendering
Apache License 2.0
672 stars 52 forks source link

Support for outlined text #176

Open villuna opened 1 month ago

villuna commented 1 month ago

Hi there, I'm currently working on a game where I have to draw a lot of outlined text, so I would really like this crate to be able to draw and cache outlined glyphs. Would this be possible?

The only solution I've come up with is to use basic outline shader in post, but this isn't ideal as you have to apply the shader every time you draw new text, and that's pretty slow. (This is a big problem for me since I need to be able to draw new text potentially every frame)

alexheretic commented 1 month ago

There is currently no baked in support for drawing glyph outline effects.

It is possible to draw them with shader logic. Perhaps there are clever ways to write that shader? This approach is already possible and outside of _glyphbrush scope.

Alternatively generate the offset outline lines/curves and feed them into _ab_glyphrasterizer to rasterize for caching into a texture you can draw underneath the regular glyphs. The crate can work with arbitrary outlines but generating them seems non-trivial. Related https://github.com/alexheretic/ab-glyph/issues/75

villuna commented 1 month ago

I see. I'll see if I can find some other way to attack this problem then. Thanks for the suggestions.