Much more lean now thanks to your feedbacks.

I prefered to "remove the shapes of the letter"
rather than doubling the shading.


Wikified https://wiki.contextgarden.net/Cover_Pages#.22Empty.22_letters





\definecolor [ColorHighA] [h=c4a000]
\definecolor [ColorHighB] [h=602217]
\definecolor [ColorLow] [0.8(white)]

\startMPpage

%------------------------------------------------------------------------------

  picture tt ;
  tt := lmt_outline [
        kind = "fillup",
        text = "\definedfont[name:texgyrepagellabold*default]%
                \framed[frame=off,offset=3mm,align=middle,strut=none]
                {MetaPost\\is Fun !\\Aujourd'hui\\Today\\*§ 2020 §*}",
    ] xsized 12cm ;

  path bb ; bb := boundingbox tt;

%------------------------------------------------------------------------------

  path pp ; pp := bb enlarged 2cm ;
  fill pp
       withshademethod "linear"
       withshadedirection (2.,0.)
       withshadecolors (\MPcolor{ColorHighA}, \MPcolor{ColorHighB});

%------------------------------------------------------------------------------

  picture Paddmissing; Paddmissing := nullpicture;
  picture Pwoletters; Pwoletters := nullpicture;
  numeric testwithin ;

%------------------------------------------------------------------------------

  for i within tt :

    if stroked i or filled i :
      testwithin :=0;

      for j within tt :
        if stroked j or filled j:
          if (((xpart llcorner i) > (xpart llcorner j)) and
              ((ypart llcorner i) > (ypart llcorner j)) and
              ((xpart urcorner i) < (xpart urcorner j)) and
              ((ypart urcorner i) < (ypart urcorner j))) :
              testwithin :=1;
          fi;
        fi;
      endfor;

      if testwithin == 1:
        addto Paddmissing contour
              (pathpart i)
              withcolor \MPcolor{ColorLow};
      else:
        addto Pwoletters contour
              (pathpart i)
              withpostscript "collect";
      fi;

    fi ;
  endfor ;

%------------------------------------------------------------------------------

  addto Pwoletters contour
        bb
        withpostscript "evenodd"
        withcolor \MPcolor{ColorLow};
  draw Pwoletters ;
  draw Paddmissing ;

\stopMPpage
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

Reply via email to