[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Accents and overshoot (Re: Round-off errors in metrics ...)

I enter this discussion with trepidation, since I remain an
unregenerate user of vf files with dual (cooked and raw) encodings,
but some of the problem with accent positioning can be solved
directly in TeX, with no manipulation of the font or font metrics.
All it requires is an encoding vector formed in the same way as 
the encoding vectors used by Tom Rokicki's dvips.  Any encoding that
includes the charstring names of all the characters you want to
flash will do.

I use this technique primarily for fonts with fully formed accented
glyphs, such as Adobe Garamond.  This is a very small subset of the total
number even of book fonts.  (Fine old classics like Bruce Rogers's 
Centaur are not so blessed.)  I am not so sure that seac composites have
anything to seriously recommend them over DEK's accent composite, but
since DEK never intended the \accent technique for use in anything
but occasional bibliographical references---he says so in several places---
one might as well use the seac composites.  

Since I happen to use the 2-vector approach to vf files (one consistent
vector for all "raw" font references, and many tailored vectors for
different "cooked" environments) the mythical HTG.enc would in my
case represent the mapping used by the TeX end of the operation,
not the dvips end.  It doesn't matter.  Any 256-element vector will

% File:       TeX Inputs htgchars.tex
% Author:     P. A. MacKay
% Internet:   mackay@cs.washington.edu
% Date:       22 July, 1995, revised 12 August, 1996
% Copyright 1996 by Humanist Typesetting & Graphics, Inc.
% Licensed under the same provisions as specified in the
% Free Software Foundation General Public License.  
% A copy of this license can be found in any software package
% issued by the Free Software Foundation (GNU).
% I have named this file to match the name of the encoding.
% If a different encoding is used, you have to change the
% hardwired name of the encoding.  Please also change the
% name of this file if you do so.
% Reads an encoding vector in the format used by dvips and afm2tfm
% and converts the charnames to TeX control sequences which
% are defined to produce the appropriate \char nnn when
% invoked.   E. g. in my usual encoding \Aacute -> \char128.
% The value for each of the \char sequences is governed
% by the order in the encoding vector.  There are no hardwired
% array indices.
% To avoid name conflict with other macros, this should be run to 
% generate control sequences only for the upper half of a regular
% text encoding based on Adobe Standard Encoding (128--255). 
% See below at ``STANDARD OR EXPERT''
% With Adobe Expert Encoding, the whole 0--255 can be used.
% Obvious problems such as the undesirable redefinition of
% \fi \space \multiply \divide are taken care of.
% The second half of this file modifies the various
% accent control codes in DEK's plain.tex to make use of the
% control sequences so generated.
\begingroup % Throw all this junk away after we're finished
            % The actual character name macros are \xdefs.
\openin1 HTG.enc
\ifeof1 \closein1 \message{ Can't find the HTG.enc encoding file.^^J
Try linking it to this directory with the command ^^J
ln -s /fonts/encodings/HTG.enc ^^J
and try again.^^J}
% I hardwire this because I'm too lazy to do anything else.
% If I need a different encoding, I change the input file
% name and also the name of this file. 
% The charnames in the encoding file are assumed to be separated
% by whitespace.  Please don`t use tabs.
\def\g@tencn@me#1 #2\tr@lb{\def\encn@me{#1}\def\bl@rt{#2}}
% The following, which appear in Expert Encoding,
%  are not much use, and could cause trouble
% And these definitely would cause trouble. Lots of it.
\count\z@=-256 % To bypass anything before the [ openbracket
\loop \ifnum\count\z@ < 256  % Could also check for EOF, but
                             % it's pretty safe to assume 256 entries.
  \read1 to \bl@rt
  \expandafter\g@tencn@me\bl@rt\tr@lb % Pick the charnames off the line
  \expandafter\r@movesl@sh\encn@me\hs@lsevom@r % Get rid of the slash
%%%%%%%%%%%%%%%%%%%%%%%  STANDARD OR EXPERT  %%%%%%%%%%%%%%%%%%%%
  \ifnum\count\@cclv > 127 % Change this to 0 for Expert Encoding
      \expandafter\xdef\csname \ch@rn@me\endcsname{\noexpand\char\ch@rc@de}
      % These definitions could be written to a file,
      % but I have never need to.
  \advance\count\@cclv by 1
  \ifx\encn@me\@penbr@cket\count\@cclv=\z@\fi % Found the open bracket
%             Reset the plain accenting macros                 %
         \else{\accent18 #1}\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi}%
         \else{\accent19 #1}\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi}%
         \else{\accent20 #1}\fi\fi\fi\fi}%
         \else{\accent94 #1}\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi}%
         \else\if#1o{{\otilde}}\else{\accent"7E #1}\fi\fi\fi\fi\fi\fi}%
         \else{\accent"7F #1}\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi}%

  \else\setbox0\hbox{#1}\ifdim\ht0=1ex\accent24 #1%
% These might become useful at some later date
% \def\u#1{{\accent21 #1}}%
% \def\=#1{{\accent22 #1}}%  
\fi % Don't do this more than once


TeX sweats a slow processor a bit on this file, but that effort
could be limited to a single instance by using a precompiled format 
for a particular task, which is always advisable in any case.

I see no reason why a LaTeX version of this approach would be impossible.

|                             N O T I C E                               |
|  Please note the address and telephone number below.                  |
|  There is no Northwest Computing Support Center any longer.           |
|                                                                       |
Email:  mackay@cs.washington.edu		Pierre A. MacKay
Smail:  Department of Classics			Emeritus Druid for
	218 Denny Hall, Box 353110		Unix-flavored TeX
	University of Washington
	Seattle, WA 98195
	(206) 543-2268 (Message recorder)