5

Following the instructions for \definespotcolor at the ConTeXt Garden, I created some outlined text:

\defineeffect[outline][alternative=outer,rulethickness=.25pt]
\starttext
    \starteffect[outline]
        \ssa This text appears as an outline.
    \stopeffect
\stoptext

I found though, this makes text with a black outline and a transparent interior, so when the page has a background image, the background text shows through. How can I create white text with a black outline?

1
  • Wrap it around a framed or backgroundtext that has a white backgroundcolor.
    – Aditya
    Commented Jun 12, 2013 at 15:57

1 Answer 1

5
+50

Here’s a solution using overlays:

overlay demo

% macros=mkvi

\definetextbackground [dark] [backgroundcolor=darkblue]

\defineeffect [outline] [
  alternative=outer,
  rulethickness=.25pt,
]

\definecolor [outlinedtext.color.fill]    [red]
\definecolor [outlinedtext.color.outline] [white]

\def\filledoutline#1{%
  \startoverlay
    {\directcolored[outlinedtext.color.fill]%
     #1}
    {\directcolored[outlinedtext.color.outline]%
     \starteffect[outline]#1\stopeffect}%
  \stopoverlay%
}

\starttext
  before
  \endgraf
  \starttextbackground[dark]%
    \filledoutline{\ssa This text appears as an outline.}
  \stoptextbackground
  \endgraf
  after
\stoptext

PS: For a more sophisticated approach see the metafun manual, section 8.6: Outline fonts (grep for graphictext).

1
  • Note that the MetaFun method is much slower than the ConTeXt method. Commented Oct 11, 2013 at 3:51

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .