[NTG-pdftex] new pdftex extensions

Thanh Han The hanthethanh at gmail.com
Wed Sep 14 10:53:17 CEST 2005


Hi,

I uploaded a patch for various new extensions to pdftex to
pdftex.sarovar.org/src

Support for extensions for paragraph formatting is already
included in the beta version of microtype. Many thanks to
Robert.

Thanh



>From README:

This is a patch for various extensions to pdftex.

How to apply:
~~~~~~~~~~~~~
,--------
| - this patch applies to the pristine pdftex-1.30.3 sources only; if you have
|   applied another patch(es) to the sources, please discard them and start from
|   the fresh ones.
| 
| - how to apply:
| 
| cd /path/to/pdftex-1.30.0-srcdir/src
| zcat /path/to/the/gzipped/patch | patch -p1
| ./configure
| cd texk/web2c
| make pdfetex
| 
| If you want to be careful, try patch with the option '--dry-run'
| first to see whether the patch can be applied wihout problems.
`--------

Included extensions:
~~~~~~~~~~~~~~~~~~~~

- \pdfinsertht: return the height of an insert; this primitive has similar
  syntax to \pdftexrevision. Example:

,--------
|   \dimen0=\pdfinsertht\footins
`--------

- snapping: support for grid typesetting. New primitives:
    - \pdfsnaprefpoint: insert a whatsit node representing a reference point

    - \pdfsnapy: insert a whatsit node that cause the position of the ``drawing
      pen'' to be moved onto a grid. This happens only during shipping phase.

      Example: after a display math it is difficult to get the next line to be
      on the grid. With snapping it might look like following:

,--------
|     <text before displayed math>
|     $$ <some math> $$
|     \vadjust pre{\pdfsnapy \snapunit plus .8\snapunit minus .2\snapunit}
|     <text after displayed math>
`--------
    
      \snapunit is a dimen, typically it would be \baselineskip. To make it
      work, there is one thing more: \pdfsnaprefpoint must be inserted into each
      page, typically in header. Let's call the y-position of this whatsit node
      Y1. The above example says roughly this: when pdftex reachs the \pdfsnapy
      node, it can move the drawing pen up and down in range
      (-.2\snapunit,.8\snapunit) to snap to a point with y-position Y2 so that
      (Y2-Y1) is a multiple of \snapunit. The \pdfsnapy node must be inserted
      before the text line following the displayed math, so we use 
      \vadjust pre{...} to insert it (\vajdust with "pre" is an extension of
      pdftex).

    - \pdfsnapycomp: insert a whatsit node for snapping compensation

      The problem with the previous example is that sometimes the space after
      math is changed too much, while the space before math remains unchanged.
      Hence the result may look ugly, because the spaces around the math are not
      proportional. So it is better that the movement after math is somehow
      compensated into the space before math too. \pdfsnapycomp is for this
      purpose. The previous example with \pdfsnapycomp will look like:

,--------
|     <text before displayed math>
|     \vadjust{\pdfsnapycomp 500}
|     $$ <some math> $$
|     \vadjust pre{\pdfsnapy \snapunit plus .8\snapunit minus .2\snapunit}
|     <text after displayed math>
`--------

      So the skip at \pdfsnapy will be distributed to 50% at \pdfcompsnap and
      50% at \pdfsnapy.
        

- some extensions for paragraph formatting:
    - \pdfadjustinterwordglue: enable adjustment of interword glue

    - \knbscode -- kern before space code. Syntax is similar to \rpcode.

      Example:

,--------
|       \pdfadjustinterwordglue=1
|       \knsbcode\font`\.=200 
|       <some text>
`--------

      means that after each period, the interword glue will be increased by an
      amount of .2em. 

    - \stbscode -- stretch before space code
      \shbscode -- shrink before space code

      Similar to \knbscode but apply to the stretch and shrink component of the
      interword glue.

    - \pdfprependkern -- enable auto-prepending kern before a char
    - \knbccode -- kern before char code. Syntax is similar to \rpcode. 
      
      This is mainly intended for typesetting languagues like French or German
      where a small kern is required before certain punctuations, eg : ; ?
    
      Example:

,--------
|       \pdfprependkern=1
|       \knbccode\font`\:=200 
|       <some text>
`--------
        
       would cause that a kern of .2em will be prepended before each colon

    - \pdfappendkern -- enable auto-appending kern after a char
    - \knaccode -- kern after char code. Syntax is similar to \rpcode. 
    
      Example:

,--------
|       \pdfappendkern=1
|       \knaccode\font`\:=200 
|       <some text>
`--------
        
       would cause that a kern of .2em will be append after each colon.
       Possible usage (from a mail from Robert Schlicht):

        ,--------
        |    French typography requires (among other things) guillemets to be 
        |    typeset as:
        | 
        |    \guillemotleft\kern0.8em word\kern0.8em\guillemotright
        `--------

        Another application is letterspacing -- a very rough example would look
        like following:

,--------
|         \pdfappendkern=1
|         \pdfprependkern=1
|         \newcount\n
|         \n=0
|         \loop
|             \knbccode\font\n=50
|             \knaccode\font\n=50
|             \advance\n 1
|         \ifnum \n < 256 \repeat
|
|         A father had two sons, of whom the eldest was clever
|         and bright, and always knew what he was about; but the
|         youngest was stupid, and couldn't learn or understand
|         ...
`--------


- support for subfonts: allow to have a single map entry for each set of
  subfonts. Example:

,--------
|     cyberbit at Unicode@ <cyberbit.ttf PidEid=3,1
`--------

    would cause pdftex to read Unicode.sfd to create all needed map entries for
    subfonts of cyberbit, and when embedding those subfonts pdftex will use the
    following mappings:

    8-bit char in tfm ==> 16-bit charcode in Unicode.sfd ==> glyph in
    cyberbit.ttf using cmap with PidEid=3,1

    The subfont TFM's however must be created manually.


More information about the ntg-pdftex mailing list