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
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the
Wiki!
maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage : https://www.pragma-ade.nl / http://context.aanhet.net
archive : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___________________________________________________________________________________