[Fontinst] Latin Modern fonts: small caps and accents

Lars Hellström Lars.Hellstrom at residenset.net
Mon May 24 17:41:48 CEST 2010

cfrees at imapmail.org skrev:
> On Mon 24th May, 2010 at 12:19, Lars Hellström seems to have written:
>> Any idea about what tool produced the AFMs? I can imagine e.g. 
>> Fontforge being "smart" enough to know about TeX fontdimens and trying 
>> to compute proper values for them, whereas I think the lmodern fonts 
>> were generated using a MetaPost-based tool that may well have a 
>> separate TFM-generation capability. In that case, the TFMs may 
>> actually be closer to the designers' intentions.
> MetaType1 is used to generate the fonts, AFMs etc. Here are the
> relevant parts of the various files.
> --- lmr10.afm ---
> StartFontMetrics 2.0
> Comment Generated by MetaType1 (a MetaPost-based engine)

Curiouser and curiouser. Seems the designers are actively contradicting 
themselves, then. This might well be reason for a bug report. 
However...  the reason the maxheight and acccapheight are different 
between AFM and TFM _could_ be that these in the AFM are computed for 
the full glyph compement but in the TFM only for the subset of glyphs 
which occur in that encoding. Vietnamese letters with double accents 
would probably be higher than all glyphs covered by the T1 encoding.

> If the TFMs supplied with Latin Modern are a better guide than the
> AFMs - which surely seems correct given the placement of accents in
> typeset documents - what is the best way of (1) determining which
> elements of the AFMs to override;

That ultimately comes down to trial and error, I'm afraid.

> and (2) actually overriding them? I
> was experimenting by manually adjusting the value of xheight for the
> small caps font using an additional metrics file, but I'm not sure
> whether that's a good way to go about things.
> --- change-xheight-sc-shapes.mtx ---
> \relax
> \metrics
> \setint{xheight}{431}
> \endmetrics
> --- lines for fontinst ---
> ...
>     \transformfont{lmcsc8ttl10}{\reencodefont{t1-clm}{\fromafm{lmcsc10}}}
>     \transformfont{lmr8ttl10}{\reencodefont{t1-clm}{\fromafm{lmr10}}}
> ...
> \installfont{clmr8t10}{lmr8ttl10,newlatin}{t1-clm}{T1}{clm}{m}{n}{<9.5-11>}
> \installfont{clmcsc8t10}{change-xheight-sc-shapes,lmcsc8ttl10,newlatin}{t1-clm}{T1}{clm}{m}{sc}{} 

An easier method to set just the one fontdimen is to use \metrics 
inline the \installfont, like so:

    \metrics \setint{xheight}{431},lmcsc8ttl10,newlatin%

To take all fontdimens but nothing else from ec-lmcsc10, a classical 
trick would be to go


but an alternative can be

    ec-lmcsc10 encoding txtfdmns,lmcsc8ttl10,newlatin%

The idea here is that txtfdmns.etx declares fontdimens but no slots, so 
ec-lmcsc10-txtfdmns.mtx will not contain anything which requires glyph 
names (which is the case with \setrawglyph and \setkern). All you get 
is \setint commands.

> --- end ---
> Given that other dimensions also seem to differ between the AFM and TFM
> files supplied with the fonts - and not just in the case of the small
> caps shaps - I don't know what's important and what isn't (since I am
> long out of my depth here).

Actually, most of them seem to match between AFM comment and supplied 
TFM. If the differences are only for max/min type fontdimens, then that 
could indeed be use to these maxes and mins being computed over 
different sets of glyphs.

Lars Hellström

More information about the fontinst mailing list