[Fontinst] Latin Modern fonts: small caps and accents

Lars Hellström Lars.Hellstrom at residenset.net
Mon May 24 12:19:26 CEST 2010

cfrees at imapmail.org skrev:
> On Sat 22nd May, 2010 at 00:11, cfrees at imapmail.org seems to have written:
>> On Fri 21st May, 2010 at 17:59, Lars Hellström seems to have written:
>>> Dr. Clea F. Rees skrev:
>>>> I am trying to update CFRLatinModern for version 2.004 of Latin Modern
>>>> (included in TL 2009 which I recently updated to). While I'm at it, I
>>>> was hoping to resolve some of the issues which I or others raised about
>>>> the earlier version of the package. (The aim of the package is to make
>>>> various features of the fonts, especially different styles of figures,
>>>> easily accessible in LaTeX.)
>>>> The following is bugging me a lot: when using the small-caps version of
>>>> the font, accent placement for characters which  must be created "on
>>>> the fly" are wrong. Not only are the accents too low for the small-caps
>>>> themselves, they are too low for the capital letters as well. So if I'm
>>>> using T1 encoding, \^A is fine but \^W and \^Y are not; similarly for
>>>> \^a versus \^w and \^y.
>>>> I don't expect these characters to look great because TeX is creating
>>>> them on the fly, but my package creates output markedly worse than that
>>>> produced by using lmodern itself and I cannot figure out why. The
>>>> accents are placed much lower so they run into the letter below.
>>>> This isn't a problem for the non-small-caps variants of the fonts - the
>>>> output produced by my package doesn't look any worse than that output
>>>> by lmodern for these characters.
>>>> I did notice that fontdimen 10 and 12 differ in lmr10.afm and
>>> Numbered fontdimens in AFMs? News to me, unless you mean AFM keywords 
>>> corresponding to acccapheight and maxheight.
>> Probably I'm explaining badly. There are a bunch of lines starting:
>> Comment TFM fontdimen <number>: <number> (text)

OK, that was news to me, and your explanation is reasonably clear.

>>>> lmcsc10.afm. These are both smaller in the case of lmcsc10.afm which
>>>> seems odd. But I'm assuming this is just my ignorance since lmodern is
>>>> obviously based on these dimensions and everything works fine there.
>>> One fontdimen that is likely to be important is xheight (fontdimen 
>>> 5), as TeX's \accent primitive assumes the accent character specified 
>>> is in the proper position for a glyph with \height{}=xheight. If for 
>>> example the smallcaps xheight is larger than the regular xheight, but 
>>> you're using the regular accent in the smallcaps font, then you would 
>>> get the effect that it is placed too low.
>> grep XHeight lmr10.afm lmcsc10.afm gives:
>> lmr10.afm:XHeight 430.55556
>> lmcsc10.afm:XHeight 513.88889
>> grep xheight lmr10.afm lmcsc10.afm gives:
>> lmr10.afm:Comment TFM fontdimen  5: 4.3055    (xheight)
>> lmcsc10.afm:Comment TFM fontdimen  5: 4.3055     (xheight)
>> So would fontinst be using the first or the second?

Fontinst uses the first, i.e., the xheight that the AFM file formally 
states. AFM Comment's are just ignored.

This difference is probably the root of your problems; with a larger 
xheight in lmcsc than in lmr, TeX thinks it needs to raise the accent 
less in the former than in the latter.

> Regarding fontdimen 12 (which I think is "max height" based on the

It is in T1-encoded fonts (and several other newer text font 
encodings). Math fonts may require it to be something else.

> afm), the dimension is smaller in lmcsc10.afm than in lmr10.afm but
> larger in ec-lmcsc10.tfm than in ec-lmr10.tfm:
> lmr10.afm:Comment TFM fontdimen 12: 11.27      (non-standard: max
> height)
> lmcsc10.afm:Comment TFM fontdimen 12: 11         (non-standard: max
> height)
> ec-lmr10.tfm:    (PARAMETER D 12 R 0.932001)
> ec-lmcsc10.tfm:   (PARAMETER D 12 R 0.933001)

Are those TFMs which come with the latin modern fonts? Curious, in that 
case, that they have two different values.

> On the other hand, when I use fontinst to generate tfms, I end up with
> this dimension being larger for lmr10 than lmcsc10:
> clmr8t10.pl:   (PARAMETER D 12 R 1.127)
> clmcsc8t10.pl:   (PARAMETER D 12 R 1.1)

That's the same as in the AFM lines you quote, so it looks as though 
you at least have these right.

A remark on the varying magnitudes of these numbers: PLs and TFMs tend 
to take 1 length unit as equal to the font size. AFMs, and fontinst 
internally, use 1000 length units equal to the font size. The AFM 
comments quoted seem to use pt as length unit, which for a 10pt font 
means 10 length units is equal to the font size.

> All of which leaves me suspecting that I really don't understand even
> the bits of this I previously thought I did understand. The
> relationship between the afms and tfms when I generate the tfms using
> fontinst makes sense to me, but how do the dimensions end up not only
> differing in the tfms included with Latin Modern but actually reversing
> relationships such as "greater than" and "less than"?!
> I assumed that the tfms provided in Latin Modern would be derived from
> the afms but now I'm wondering if that's so...

One would expect that they are at least generated from the same source, 
but the fact that the AFMs contain hints about what would be good TFM 
fontdimens, which the TFMs don't seem to care about, indicates there is 
something odd about the toolchain producing these files.

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.

Lars Hellström

More information about the fontinst mailing list