[texhax] dotfill leaders on first line of paragraph only ?
Pierre MacKay
pierre.mackay at comcast.net
Thu Dec 8 03:29:40 CET 2011
On 12/7/2011 4:29 PM, Heiko Oberdiek wrote:
> On Wed, Dec 07, 2011 at 06:46:59PM +0000, Philip TAYLOR wrote:
>
>> Philip TAYLOR wrote:
>>
>>> OK, thank you William : in that case it is presumably necessary only
>>> to redefine the font selectors so that when I (for example) use
>>> \normalfont in my document, this does not resolve to a simple
>>> font selector but rather to a macro that expands to
>>> \concealednormalfont \special {...}.
>> Unfortunately not as simple as I had hoped.
>> Now, given :
>>
>> \let \Font = \font
>> \def \font #1= #2 at #3 pt
>> {
>> \message {Loading font \string #1 = #2 at #3 pt}
>> \expandafter \Font \csname font:\string #1\endcsname = #2 at #3 pt \relax
>> \edef #1{\csname font:\string #1\endcsname \special {color cmyk 0 0 0 1}}
>> }
>>
>> (i.???, initially mapping all fonts to black)
>>
>> I get
>>
>>> ** WARNING ** You've mistakenly made a global color change within nested colors.
>>> ** WARNING ** You've mistakenly made a global color change within nested colors.
>>> ** WARNING ** You've mistakenly made a global color change within nested colors.
>> (repeated many many times).
> You are reinventing the wheel.
>
> Study color.sty, xetex.def and the color stuff of latex.ltx
> to learn how colors can be handled.
>
> To get TeX group working with colors, the colorstack
> is useful:
>
> \def\ResetColor{\special{color pop}}
> \def\SetColor#1{\color{color push #1}\aftergroup\ResetColor}
>
> Then you can add a color e.g. cyan as \SetColor{cmyk 1 0 0 0} to your font
> command.
>
> Care is needed with \setbox, it needs an additional grouping level to avoid
> a wrong placement of the \special by \ResetColor that is called via
> \aftergroup, e.g.:
>
> \setbox0=\hbox{\begingroup ...\SetColor{cmyk 1 0 0 0}...\endgroup}
>
> Yours sincerely
> Heiko Oberdiek
>
What I miss in these examples is gsave . . . grestore scoping. I have
had to set up journal covers with various solid-color PANTONE effects to
supply limited scope colored fonts in different colors, It may be a bit
of a nuisance to limit the scope on every limited color change, but it
certainly saves a lot of headaches. In addition, if I have any color
other than (cmyk 0 0 0 1) for the principal font over several pages, I
renew it by using Tom Rokicki's bophook and eophook on every page
(mostly to set yet another gsave . . . grestore scope and avoid the risk
of falling into a (cmyk 0 0 0 1) default color hole). \begingroup . . .
\endgroup scoping may well be needed too, but it is not meaningful to
PostScript.
Printers often insist on a named PANTONE ink that they happen to use
regularly. Arbitrary mixes of colors are frowned on.
Pierre MacKay
More information about the texhax
mailing list