Behaviour of \latinfamily
Ulrik Vieth
vieth@thphy.uni-duesseldorf.de
Thu, 28 May 1998 12:43:35 +0200
>> because shape ui is not requested by \latin_family. it only asks for
>>
>> \def\latin_shapes{
>> \latin_shape{} {} {} {n}
>> \latin_shape{c}{c}{} {sc}
>> \latin_shape{o}{o}{} {sl}
>> \latin_shape{i}{i}{i}{it}
>> }
>>
>> so the ui=it substitution is never activated.
>>
>> you are screaming now, aren't you?
> Very nearly... Yes, I've looked at the source code and I'm none the
> wiser. Can you explain two things:
> 1) What calls \latin_shapes and when.
> 2) What \latin_shapes does.
That's what I tried to explain last time.
You call e.g. \latinfamily{ptm}{}, which calls \parse_family to
intialize some variables such as \font_familly and \latex_family.
Then it calls \latin_weights, which does a number of calls such as
\latin_weight{r}{m}
\latin_weight{s}{sb}
\latin_weight{b}{b}
Each of these calls stores the arguments in the variables \font_weight
and \latex_weight and continues to call \latin_widths.
\latin_widths, in turn, does a number of calls such
\latin_width{}{}
\latin_width{n}{c}
Each of these calls stores the arguments in the variables \font_width
and \latex_width and continues to call \latin_shapes.
\latin_shapes, in turn, does a number of calls such
\latin_shape{} {} {} {n}
\latin_shape{c}{c}{} {sc}
\latin_shape{o}{o}{} {sl}
\latin_shape{i}{i}{i}{it}
Each of these calls stores the arguments in the variables \font_shape,
\raw_shape, \encoding_shape and \latex_shape and continues to do some
actual processing for some particular combination of family, weight,
width, and shape.
What is eventually needed to install a T1 or OT1 encoded font shape,
is an 8r-encoded .mtx file for this combination of attributes.
Before trying to open that .mtx file and calling \latin_encodings,
two macros \fake_width_<width> and \fake_shape_<shape> are called,
which do quite a lot of work.
Let's ignore the effect of \fake_width_ for a moment and just look
at the effect of \fake_shape_<shape>.
* For the normal shape, \fake_shape_ is called, which looks for an
8a-encoded .afm files, and if so, it calls
\transformfont{<font>8r}{\reencodefont{8r}{\fromafm{<font>8a}}}
Internally, this runs
\afmtomtx{<font>8a}{<font>8a}
\mtxtopl{<font>8a}{<font>8a}
\mtxtomtx{<font>8a}{<font>8r}
\mtxtopl{<font>8r}{<font>8r}
and produces the files <font>8a.mtx, <font>8a.pl, <font>8r.mtx
and <font>8r.pl.
Then it calls \installrawfont for <font>8r, which adds an entry to
the internal token list, which is eventually written to 8r<fam>.fd
at the end of the job.
* For the oblique shape, \fake_shape_o is called, which first looks
for a corresponding 8a-encoded .afm file of a real obliuqe font.
If it exists, it calls \fake_shape_ to do the same steps as above,
which implies running
\afmtomtx{<font>o8a}{<font>o8a}
\mtxtopl{<font>o8a}{<font>o8a}
\mtxtomtx{<font>o8a}{<font>o8r}
\mtxtopl{<font>o8r}{<font>o8r}
If a real oblique font isn't found, \fake_shape_o_raw_encoding
is called, which does
\transformfont{<font>o8r}{\slantfont{167}{\frommtx{<font>8r}}}
Internally, this runs
\mtxtomtx{<font>o8r}{<font>8r}
\mtxtopl{<font>o8r}{<font>o8r}
and produces the files <font>o8r.mtx and <font>o8r.pl.
Then it calls \installrawfont for <font>o8r, as above.
* For the small caps shape, \fake_shape_c is called, which first looks
for a corresponding 8a-encoded .afm file of a real small caps font.
If it exists, it calls \fake_shape_ to do the same steps as above,
which implies running
\afmtomtx{<font>c8a}{<font>c8a}
\mtxtopl{<font>c8a}{<font>c8a}
\mtxtomtx{<font>c8a}{<font>c8r}
\mtxtopl{<font>c8r}{<font>c8r}
If a real small caps font isn't found. \raw_shape and \encoding_shape
are redefined to {} to {c}, before calling \fake_shape_ once again.
This wil produce an 8r-encoded .mtx file for the default shape,
if that hasn't been done already before.
The effect of setting \encoding_shape will come into play later when
\latin_encodings is called, in which case it will use a different .etx
file (T1c.etx or OT1c.etx) to generate a faked small caps font.
* Finally, for an italic shape \fake_shape_i is called, which does
the same steps as \fake_shape_ for the default shape. If a real
italics fonts exists, it will look for an 8a-encoded .mtx file and
produce an 8r-encoded .mtx file.
\afmtomtx{<font>i8a}{<font>i8a}
\mtxtopl{<font>i8a}{<font>i8a}
\mtxtomtx{<font>i8a}{<font>i8r}
\mtxtopl{<font>i8r}{<font>i8r}
If it doesn't exists, there's no way to fake it, and \latin_shape will
return without calling \latin_encodings. Similarly, if a font weight
doesn't exists, all the \fake_shape_<shape> macros will return without
doing anything, since a missing weight can't be faked.
Hope this explanation was a little clearer this time. Still, so far
we have only dealt with .mtx and .pl files for 8r-encoded raw fonts.
I haven't looked at what happens, when \latin_encodings is called to
produce .vpl files for the OT1 or T1 encoding.
Cheers, Ulrik.