[NTG-pdftex] Colored text, was [ pdftex-Bugs-389 ] Spacing Bug with \pdfliteral direct

Hartmut Henkel hartmut_henkel at gmx.de
Fri Jul 15 21:25:22 CEST 2005

On Fri, 15 Jul 2005 noreply at sarovar.org wrote:

> Comment By: Martin Schröder (oneiros)
> Date: 2005-07-15 15:25
> Message:
> Logged In: YES
> user_id=421
> This has been fixed in 1.30.0

Thanks a lot, Martin! Let's hope that it's ok. The change also can
affect the PDF file size where lots of \pdfliterals are used for color
change. E. g. if in pdfcolor.tex (used by pdfwebmac.tex) the \pdfliteral
is changed to its direct version, the pdfetex.pdf file made from the
pdfetex.web/.ch sources is smaller by about 8% iirc, while looking

Also the following font coloring seems to work more efficiently; the
recipe is an update from an E-Mail to texhax at 29 Feb 2004:

Start from cmr10.tfm, put this into some working directory. Then:

$ tftopl cmr10.tfm > cmr10.pl
$ cp cmr10.pl cmrcolor10.vpl

Now in the file cmrcolor10.vpl change


and just before the 1st line


in cmrcolor10.vpl add a line


so that the cmrcolor10.vpl references cmr10.tfm as real font.

Then do

$ vptovf cmrcolor10.vpl

which creates

Then do

$vftovp cmrcolor10.vf > cmrcolor10.vpl

which re-creates

Now you have reached the first goal: A cmrcolor10.vpl file ready for
your tweaking. Then you can add funny pdfTeX specials e. g. by some awk

$ export LANG="C" ; awk -f addspecial.awk cmrcolor10.vpl > temp
$ mv temp cmrcolor10.vpl

where the addspecial.awk looks like:

#begin of addspecial.awk
  r = 0.6 * rand();
  g = 0.6 * rand();
  b = 0.6 * rand();
  printf("      (SPECIAL pdf:direct: %.3f %.3f %.3f rg)\n", r, g, b);
  print $0;
  printf("      (SPECIAL pdf:direct: 0 0 0 rg)\n");

#end of addspecial.awk

Then do a final

$ vptovf cmrcolor10.vpl

This creates the working versions

Now you can call the colored font by pdftex e. g. from the following
tex file:

\font\cmrcolor cmrcolor10 at 10pt
\input tufte

BTW, don't try to use \ptexuniformdeviate in the special. It's not
expanded at this late time; else one would get a completely randomly
colored font...

Have fun!

Regards, Hartmut

More information about the ntg-pdftex mailing list