[NTG-context] color in pdfTeX

Hartmut Henkel ntg-context@ntg.nl
Thu, 4 Mar 2004 23:56:10 +0100 (CET)


On Thu, 4 Mar 2004, pawcoo wrote:

> > Lines with width <= 1 bp are stroked by pdftex, lines wider than that
> > are filled (procedure pdf_set_rule). Stroking CMYK color is set by K,
> > nonstroking by k, so you need both:

Note, forgot this: This only affects the \hrule and \vrule primitives.
When you do lines by literals, you are on your own...

> > \pdfliteral{0 1 0 0 k}
> > \pdfliteral{0 1 0 0 K}
>
> Thanks! That works. I'll dare to ask one more question. How to use
> colors in (some kind of) groups, meaning localy? In example, how to
> set some nice color for given object only (word, letter or rule)? Or
> should I always say something like
>
> \pdfliteral{0 1 0 0 k}
>   colorized text
> \pdfliteral{0 0 0 1 k} % come back to black

Seems to be currently the only way. The \pdfliteral{} primitives are
done between two x/y transformations, so you can't use q/Q grouping.
And the \pdfliteral direct{} variant doesn't help either, as it comes
before BT, but also _before_ ET, so grouping would be broken also.
Probably something to consider for a change...

Regards, Hartmut