Makie.jl icon indicating copy to clipboard operation
Makie.jl copied to clipboard

`text`: stroke and glow overwrites consecutive letters

Open thchr opened this issue 3 years ago • 2 comments

When a glow or stroke effect is applied to a text object, it seems to apply to each letter in such a way that the stroke of one letter can occlude the other, which doesn't seem very useful.

Example below:

f = Figure(resolution=(200,200))
ax = Axis(f[1,1])
text!(ax, 0,-.5; text="Strokes", strokecolor=:green, strokewidth=8, align=(0.5,0.5))
text!(ax, 0,.5;  text="Glow",    glowcolor=:purple,  glowwidth=8,   align=(0.5,0.5))
limits!(ax, -.5,.5,-1,1)

which produces

image

What I had hoped for something like this (which is what e.g. Adobe Illustrator will do for stroke-outlines on text):

thchr avatar Aug 25 '22 21:08 thchr

I don't think glmakie would be easily able to make one stroke for the text as a whole, as each letter is a separate signed distance texture that is drawn on separate quads.

For cairomakie, it could be done in principle but only if a single color is used.

jkrumbiegel avatar Aug 27 '22 08:08 jkrumbiegel

If you just really need this now for a specific plot, you could plot the text with stroke once, probably best to give the text the same color as the stroke. Then plot the text again, now without stroke, in whatever foreground color you want.

jkrumbiegel avatar Aug 27 '22 08:08 jkrumbiegel

Maybe we need to start implementing stroke + glow as different passes... That'd also make the shader in GLMakie quite a bit simpler, and make it actually usable... Right now it mainly makes the shader harder to implement, while not even that usable as this issue shows.

SimonDanisch avatar Apr 27 '23 10:04 SimonDanisch

Added such a two-step recipe to MakieExtra.jl for now: use as glowtext! with the same arguments as text!. See docs for more details. image

aplavin avatar Jul 11 '24 23:07 aplavin