Immediate-Mode-UI / Nuklear

A single-header ANSI C immediate mode cross-platform GUI library
https://immediate-mode-ui.github.io/Nuklear/
Other
9.34k stars 571 forks source link

text shadows is possible? #193

Open Omn1z opened 4 years ago

Omn1z commented 4 years ago

shadows or outline

dumblob commented 4 years ago

Hm, I don't know of any built-in way to have shadows. But it should be pretty easy to hack it together yourself (just take a copy of the rendered font, make the color a bit lighter and place the resulting bitmap with some tiny offset in both axes behind the original render). Will be a bit slower, but shouldn't be a big deal.

Outline on the other hand seems more about the font rendering backend which is just copy&pasted stb_truetype, so I'd ask there.

FrostKiwi commented 3 years ago

Though I have not tried it out myself, stb_truetype supports SDF character baking. SDF text rendering supports shadows and outline by default. Though something would need changing in your backend implementation to support this and the needed SDF shader.

However stb_truetype's SDF implementation only supports single channel SDF, which may change the appearance of your font by rounding or slicing off glyph corners. If I ever get around to it, I wanted to fuse the output of https://github.com/Chlumsky/msdfgen and Nuklear at some point.

ryuukk commented 2 months ago

I'm currently trying to add that feature

Currently trying to figure out how to add some padding to the rects so i could then apply some effects when baking

Any help or guidance is more than welcome

ryuukk commented 2 months ago

I ended up doing this: https://github.com/Immediate-Mode-UI/Nuklear/issues/698