# [Fontinst] problem with 8y.etx

Lars Hellström Lars.Hellstrom at math.umu.se
Wed Dec 10 18:25:16 CET 2003

At 16.49 +0100 2003-12-10, Paul Pichaureau wrote:
>  I'm trying to use the 8y.etx file (texnansi encoding vector).
>
>  I am very surprised  to find the command
>
>     \ifdirect
>
>in many place. This command seems to be undocumented. I found no
>information in the source

Then what of fimain.dtx lines 760--794? Behold:

% \begin{switch}{direct}
%   The encoding aspect of a font can to a large extent be understood
%   as a mapping from the set of slots to the set of glyphs---such
%   mappings are for example realised by PostScript encoding vectors
%   (mapping slots to glyph names) and virtual fonts (mapping slots to
%   DVI commands for drawing a glyph). In some cases however, encodings
%   are rather used to specify an inverse mapping going the opposite
%   way. Since encodings are in general many-to-one, this means there
%   need not be a proper inverse to a given encoding; instead the
%   inverse image of a glyph is in practice chosen randomly\footnote{In
%   the sense: according to a very deterministic (but not particularly
%   useful) rule which depends completely on details in the
%   implementation, and therefore should not be relied upon anyway.}
%   among the slots that are mapped to it. This is not always desirable.
%
%   The \texttt{direct} switch can be used to check whether an encoding
%   is interpreted in the direct (slots to glyphs) or inverse (glyphs to
%   slots) manner. If those |\setslot| commands which are undesirable
%   under the inverse interpretation are put inside an |\ifdirect|
%   \dots\ |\Fi| construction, then these will be ignored in that
%   circumstance, thus allowing the programmer to exactly specify both
%   the direct and the inverse mappings.
%
%   In \package{fontinst}, this command is a switch, which is usually
%   true.
%    \begin{macrocode}
%<pkg|misc>\newif\ifdirect \directtrue
%    \end{macrocode}
%   In \package{fontdoc}, this is a conditional that will be typeset
%   if |\showbranches| is being used.
%    \begin{macrocode}
%<doc>\newcommand\ifdirect{\generic at if{direct}}
%    \end{macrocode}
% \end{switch}

The fisource.dvi index entry for \ifdirect should point you to the above
passage.

>neither in the 'regular' documentation.

Yes, that is out of date (but then it only claims to describe v1.8, does it
not?).

>Can someone explain the purpose and the usage of this command ?
>
>My exact problem is when I try to reencode a font:
>
> \transformfont{putr8y}{\reencodefont{8y}{\fromafm{putr8a}}}
>
>I obtain an uncorrect putr8y.mtx file: many char are in a wrong slot.
>
>It seems that each time a \ifdirect is read in the *.etx file a slot