# 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
work.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 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.
%
\ifx\htgchars\undefined
\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}
\endgroup
\else
% 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.
\catcode\@=11
% The charnames in the encoding file are assumed to be separated
% by whitespace.  Please dont use tabs.
\def\g@tencn@me#1 #2\tr@lb{\def\encn@me{#1}\def\bl@rt{#2}}
\def\r@movesl@sh#1#2\hs@lsevom@r{\def\ch@rn@me{#2}}
\def\bl@rt{}
\def\bl@@rt{}
\def\notd@f{.notdef}
\def\@penbr@cket{[}
% The following, which appear in Expert Encoding,
%  are not much use, and could cause trouble
\def\colonch@ck{colon}
\def\commach@ck{comma}
\def\hyphench@ck{hyphen}
\def\semicolonch@ck{semicolon}
\def\periodch@ck{period}
% And these definitely would cause trouble. Lots of it.
\def\fich@ck{fi}
\def\mulch@ck{multiply}
\def\divch@ck{divide}
\def\spacech@ck{space}
%
\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.
\ifx\bl@@rt\bl@rt
\else
\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
\ifx\ch@rn@me\notd@f\else
\edef\ch@rc@de{\the\count\@cclv}
\ifx\ch@rn@me\fich@ck\def\ch@rn@me{fichar}\fi
\ifx\ch@rn@me\colonch@ck\def\ch@rn@me{colonchar}\fi
\ifx\ch@rn@me\commach@ck\def\ch@rn@me{commachar}\fi
\ifx\ch@rn@me\hyphench@ck\def\ch@rn@me{hyphenchar}\fi
\ifx\ch@rn@me\semicolonch@ck\def\ch@rn@me{semicolonchar}\fi
\ifx\ch@rn@me\periodch@ck\def\ch@rn@me{periodchar}\fi
\ifx\ch@rn@me\spacech@ck\def\ch@rn@me{spacechar}\fi
\ifx\ch@rn@me\mulch@ck\def\ch@rn@me{multiplychar}\fi
\ifx\ch@rn@me\divch@ck\def\ch@rn@me{dividechar}\fi
\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.
\fi
\fi
\ifx\encn@me\@penbr@cket\count\@cclv=\z@\fi % Found the open bracket
\fi
\repeat
\catcode\@=12
\endgroup
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%             Reset the plain accenting macros                 %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\def\#1{\if#1A{{\Agrave}}\else\if#1E{{\Egrave}}\else\if#1I{{\Igrave}}%
\else\if#1O{{\Ograve}}\else\if#1U{{\Ugrave}}\else
\if#1a{{\agrave}}\else\if#1e{{{\egrave}}}\else\if#1i{{\igrave}}%
\else\if#1o{{\ograve}}\else\if#1u{{\ugrave}}%
\else{\accent18 #1}\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi}%
\def\'#1{\if#1A{{\Aacute}}\else\if#1E{{\Eacute}}\else\if#1I{{\Iacute}}%
\else\if#1O{{\Oacute}}\else\if#1U{{\Uacute}}\else\if#1Y{{\Yacute}}\else
\if#1D{{\Eth}}\else\if#1T{{\Thorn}}\else
\if#1a{{\aacute}}\else\if#1e{{\eacute}}\else\if#1i{{\iacute}}%
\else\if#1o{{\oacute}}\else\if#1u{{\uacute}}%
\else\if#1y{{\yacute}}\else\if#1d{{\eth}}\else\if#1t{{\thorn}}%
\else{\accent19 #1}\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi}%
\def\v#1{\if#1S{{\Scaron}}\else\if#1Z{{\Zcaron}}\else
\if#1s{{\scaron}}\else\if#1z{{\zcaron}}%
\else{\accent20 #1}\fi\fi\fi\fi}%
\def\^#1{\if#1A{{\Acircumflex}}\else\if#1E{{\Ecircumflex}}\else
\if#1I{{\Icircumflex}}%
\else\if#1O{{\Ocircumflex}}\else\if#1U{{\Ucircumflex}}\else
\if#1a{{\acircumflex}}\else\if#1e{{\ecircumflex}}\else
\if#1i{{\icircumflex}}%
\else\if#1o{{\ocircumflex}}\else\if#1u{{\ucircumflex}}%
\else{\accent94 #1}\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi}%
\def\~#1{\if#1A{{\Atilde}}\else\if#1N{{\Ntilde}}\else\if#1O{{\Otilde}}%
\else\if#1a{{\atilde}}\else\if#1n{{\ntilde}}%
\else\if#1o{{\otilde}}\else{\accent"7E #1}\fi\fi\fi\fi\fi\fi}%
\else\if#1O{{\Odieresis}}\else\if#1U{{\Udieresis}}\else
\else\if#1o{{\odieresis}}\else\if#1u{{\udieresis}}%
\else\if#1y{{\ydieresis}}%
\else{\accent"7F #1}\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi}%

\def\c#1{\if#1C{{\Ccedilla}}\else\if#1c{{\ccedilla}}%
\else\setbox0\hbox{#1}\ifdim\ht0=1ex\accent24 #1%
\else{\ooalign{\unhbox0\crcr\hidewidth\char24\hidewidth}}\fi\fi\fi}%
\fi
%
% These might become useful at some later date
% \def\u#1{{\accent21 #1}}%
% \def\=#1{{\accent22 #1}}%
\def\htgchars{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)