[ pdftex-Bugs-389 ] Spacing Bug with \pdfliteral direct
![](https://secure.gravatar.com/avatar/adfff96f4299fb3ee3b199b06eea68da.jpg?s=120&d=mm&r=g)
Bugs item #389, was opened at 2005-07-14 08:34 You can respond by visiting: http://sarovar.org/tracker/?func=detail&atid=493&aid=389&group_id=106 Category: Literals Group: v1.30.0
Status: Closed Resolution: Fixed Priority: 3 Submitted By: Hartmut Henkel (hhenkel) Assigned to: The Thanh Han (hanthethanh) Summary: Spacing Bug with \pdfliteral direct
Initial Comment: "\pdfliteral direct" screws up spacing. Hans found it. Therefore one has to use the non-direct variant e. g. for changing color in text, which results in tedious transforms. The trivial patch seems to solve this. Now it's possible to define color "direct". See the test.pdf file. Actually i don't understand at all what the patch does, but it seemed to be the only place where the literal interferes with position calculations. It seems that the patch does not mangle the horizontal positioning calculation; see the placement of the \vrule after the ET, which is independent from whether \pdfliteral direct is used or not. Rough patch. Tests welcome. Regards, Hartmut ---------------------------------------------------------------------- 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 ---------------------------------------------------------------------- Comment By: Taco Hoekwater (taco) Date: 2005-07-14 10:28 Message: Logged In: YES user_id=1608 I did some extra tests with spaces around the grey text, and it output turned out ok. I don't understand this trickery with pdf_first_space_corr at all, but since it seems to work i'm reluctant to spend an indeterminate amount of time on discovering the intent of it. Patch looks good, afaict. ---------------------------------------------------------------------- You can respond by visiting: http://sarovar.org/tracker/?func=detail&atid=493&aid=389&group_id=106
![](https://secure.gravatar.com/avatar/ad5afbb91c8b5ec2b1199838461a8348.jpg?s=120&d=mm&r=g)
On Fri, 15 Jul 2005 noreply@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 similar. 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 (FAMILY CMR) into (FAMILY CMRCOLOR) and just before the 1st line (CHARACTER O 0 in cmrcolor10.vpl add a line (MAPFONT D 0 (FONTNAME cmr10)) so that the cmrcolor10.vpl references cmr10.tfm as real font. Then do $ vptovf cmrcolor10.vpl which creates cmrcolor10.tfm cmrcolor10.vf Then do $vftovp cmrcolor10.vf > cmrcolor10.vpl which re-creates cmrcolor10.vpl 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 script: $ export LANG="C" ; awk -f addspecial.awk cmrcolor10.vpl > temp $ mv temp cmrcolor10.vpl where the addspecial.awk looks like: #begin of addspecial.awk /SETCHAR/{ 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"); next; } //{print} #end of addspecial.awk Then do a final $ vptovf cmrcolor10.vpl This creates the working versions cmrcolor10.tfm cmrcolor10.vf Now you can call the colored font by pdftex e. g. from the following tex file: \pdfcompresslevel=0 \font\cmrcolor cmrcolor10 at 10pt \cmrcolor \input tufte \bye 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
participants (2)
-
Hartmut Henkel
-
noreply@sarovar.org