Hi, maybe you remember that I wanted this since 2017... I finally managed to get a fuzzy background behind text: """ \setupbodyfont[ss,24pt] \definecolor[tshade][t=.05,a=1,k=1] \starttexdefinition MyCaption #1 \startMPcode{doublefun} steps := 10 ; rulesize := BodyFontSize/steps/3; for step = 1 upto steps: draw lmt_outline [ text = "\bf #1", %style = "bold", % doesn’t work kind = "both", fillcolor = "white", drawcolor = "tshade", rulethickness = (step*rulesize), ]; endfor; \stopMPcode \stoptexdefinition \starttext \MyCaption{Eine wunderschöne Bildunterschrift} \stoptext """ Remaining problems: * lmt_outline doesn’t understand "style"; would be nice. * I don’t understand why the white fill is not opaque. Hraban
Am 06.07.23 um 21:27 schrieb Henning Hraban Ramm:
* I don’t understand why the white fill is not opaque.
Posted too early. I do understand now (overlapping outlines). Tried to fix it by overwriting the text again in white, but now I don’t understand how to calculate the shifting: """ \setupbodyfont[ss,24pt] \definecolor[tshade][t=.05,a=1,k=1] \starttexdefinition MyCaption #1 \startMPcode{doublefun} steps := 10 ; rulesize := BodyFontSize/steps/3; for step = 1 upto steps: draw lmt_outline [ text = "\bf #1", %style = "bold", % doesn’t work kind = "both", fillcolor = "white", drawcolor = "tshade", rulethickness = (step*rulesize), ] xshifted -193; % why is this shifted at all? endfor; draw lmt_text [ text = "#1", style = "bold", color = "white", ] yshifted (steps*rulesize); \stopMPcode \stoptexdefinition \starttext \MyCaption{Eine wunderschöne Bildunterschrift} \MyCaption{Ein ganz anderer Text} \stoptext """ Hraban
Please, can you explain why the result of lmt_outline is shifted to the right, if I use it in a macro? """ \setupbodyfont[ss,24pt] \definecolor[tshade][t=.05,a=1,k=1] \starttexdefinition MyCaption #1 \startMPcode steps := 5 ; % number of shadow layers rulesize := BodyFontSize/steps/3; for step = 1 upto steps: draw lmt_outline [ text = "\bf\strut #1", kind = "fillup", fillcolor = "tshade", rulethickness = (step*rulesize), ]; endfor; draw lmt_text [ text = "\bf\strut #1", %style = "bold", color = "white", ] yshifted (BodyFontSize*2/3); % TODO \stopMPcode \stoptexdefinition \starttext % this is OK \startMPcode draw lmt_outline [ text = "\bf\strut The quick brown fox jumps over the lazy dog.", kind = "fillup", fillcolor = "blue", rulethickness = 2, ]; \stopMPcode % here the shadow gets a different offset each time – % the longer the text, the bigger the offset \MyCaption{The quick brown fox jumps over the lazy dog.} \MyCaption{Eine wunderschöne Bildunterschrift} \MyCaption{Ein ganz anderer Text} \stoptext """ BTW I recognized I need this not only for captions within images but also for the glow effect in the CCCamp23 style: https://events.ccc.de/camp/2023/infos/styleguide.html InDesign etc. create for stuff like this a pixel image including the background – we can do better and keep this vector-only. ;) Hraban
participants (1)
-
Henning Hraban Ramm