Behaviour of \latinfamily

Ulrik Vieth vieth@thphy.uni-duesseldorf.de
Tue, 26 May 1998 15:26:48 +0200


>> Try runnig
>> 
>> perl make-fam.pl -debug -outdir ../cooked/<whatever> <famcode>
>> ^^^^^^
>> to preserve the log files and temporary files, if you really want to
>> see what's going on behind the scenes.

> I'm not sure what you're talking about here.  I have the log files.
> They do not tell me what I want to know.  I've not mentioned using
> Perl.  I have some Perl scripts to automate the use of fontinst but
> I haven't the faintest idea how to use any of them.

Sorry.  I was referring to Sebastian's perl scripts, assuming that
these were the standard interface to using fontinst nowdays.
In thie end, these perl scripts produce a temporary TeX files, which
basically calls 

  \input fontinst.sty
  \latinfamily{<famcocde>}

and something similar. for the text companion encoding.

>> Another point to note is that after the above-mentioned message is
>> issued by the macro \latin_shape, stating that fontinst is apparently
>> looking for some 8r-encoded .mtx file,

> Ah!  Information.  How can you tell that fontinst is looking for an mtx file?

>> various other macros are called,
>> such as \fake_width or \fake_shape, which in turn look for 8a-encoded
>> .afm files and issue the necessary  \transformfont and \reencodefont
>> commamds to produce a suitable 8r-encoded .mtx file.

> Does a list exist of which transformations and re-encodings fontinst
> will do on its own?  I'm trying to document the process, you see,
> and I can't work out any of these points from the source code or log
> files.

I'm afraid you'll have to work it out from the source code and the 
log files.  That's exactly what I tried to do in my previous mail.


>> As a first step, \latin_shape calls
>> 
>> \csname fake_width_\font_width\endcsname,
>> 
>> where \font_width is empty, i.e. \fake_width_ is called,
>> which happens to do nothing.

> Can you explain what this means?

See TeXbook, chapter 20 (?) for \csname...\encsname.  Basically

  \csname fake_width_\font_width\encsname 

expands to a call of a macro \fake_width_ or \fake_width_n, 
depending on whether \font_width is empty or defined to 'n'.

>> As a second step, \latin_shape calls
>> 
>> \csname fake_shape_\raw_shape\endcsname
>> 
>> where \raw_shape is empty, i.e. \fake_shape_ is called,
>> which does the following:

Here, it is the same mechanism.

  \csname fake_shape_\raw_shape\endcsname

expands to a call of a macro \fake_shape_ or \fake_shape_o 
or \fake_shape_c or \fake_shape_i, which are all defined
in fontinst.sty. 

> You said above that fontinst was looking for an mtx file, and here
> you say it's looking for an afm file.  Can you explain what's going
> on?  I gather fontinst can work with pl, afm, or mtx files.  Which
> sort is it looking for here, and if it looks for more than one,
> what's the search order?

I don't know exactly, at which point .fd files come into play.
In general, fontinst needs an .mtx file to start the reencoding
business, which is can generate itself from .afm or .pl files.

>> * it calls
>> 
>> \transformfont{pckm8r}{\reencodefont{8r}{\fromafm{pckm8a}}}
>> 
>> * it calls
>> 
>> \installrawfont{FONT-NAME}{FILE-LIST}{ETX}{ENCODING}
>> {FAMILY}{SERIES}{SHAPE}{SIZE}
>> 
>> \installrawfont{pckm8r}{pckm8r,8r}{8r}{8r}{pck}{m}{n}{}

> Can you explain what this means and does?

\transformfont should be clear, as its is documented in the LGC.
\installrawfont is trickier, but I suppose it is the interanl
function which is called by higher-level \installfont macros
and eventually produces an .fd file from a temporary .mtx file.

>> The calling sequence of fontinst goes something like \latinfamily ->
>> \latin_weights -> \latin_widths -> \latin_shapes -> \latin_encodings,
>> where each step goes throgh a list of individual calls for a number
>> of predefined weights, widths, shapes and encodings.

> Can you explain what you mean by this?

I suppose, I'll have to write several pages to explain this in detail,
and I don't have time for that right now.

>> Whenever it finds a suitable match,

> What's a suitable match, and what makes fontinst look for the things to
> match?  Sorry if this question's a bit obscure, but I've no idea what
> you're talking about.  fontinst just sits there until you start executing
> commands.  Which commands cause it to exhibit this behaviour?

You call 

  \latinfamily

which in turn calls the chain of 

  \latin_weights -> \latin_widths -> \latin_shapes -> \latin_encodings

Each of these macros processes a list of individual calls to
\latin_weight, \latin_width, \latin_shape, etc. whic do the real work.


> But I've never seen fontinst place any entries in a 8r.fd file, even
> though it's created 8r.fd files for me quite happily.

This might be a problem indeed.  The default settings of \latin_encodings
tell fontinst to proudce OT1 and T1 only, so I don't know, why this is 
generated in the first place.

> I've also not worked out how it does fount substitutions.  I've read
> various explanations, but they don't tie up with my observations.
> In particular, I've not seen fontinst substitute it for ui.

I believe it does so or OT1 only because of \pounds vs. \dollar.

> I have studied the code and it makes no sense at all to me.  
> I'm afraid your explanations don't make much sense for pretty much
> the same reason: it seems that I'm supposed to be able to work out
> all sorts of things that aren't stated explicitly.  Well, I've
> tried, and got no-where.

I'm afraid this sounds as if you've volunteered to do a task for which
you are not qualified.  If there is no other doucmentation, you have
no choice but working it out from the source.  Good luck!

Cheers, Ulrik.