[Fontinst] Latin Modern fonts: small caps and accents
cfrees at imapmail.org
cfrees at imapmail.org
Mon May 24 13:19:47 CEST 2010
On Mon 24th May, 2010 at 12:19, Lars Hellström seems to have written:
> 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.
>
Yes. These are the ones that come with the fonts. (I just used tftopl
to look at the 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.
>
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)
...
FontName LMRoman10-Regular
FullName LMRoman10-Regular
FamilyName LMRoman10
Weight Normal
ItalicAngle 0
IsFixedPitch false
UnderlinePosition -146
UnderlineThickness 40
Version 2.004
EncodingScheme FontSpecific
FontBBox -430 -290 1417 1127
CapHeight 683.33333
XHeight 430.55556
Descender -194.44444
Ascender 694.44444
Comment PFM parameters: LMRoman10 0 0 0xEE
Comment TFM designsize: 10 (in points)
Comment TFM fontdimen 1: 0 (slant)
Comment TFM fontdimen 2: 3.33333 (space)
Comment TFM fontdimen 3: 1.66667 (space stretch)
Comment TFM fontdimen 4: 1.11111 (space shrink)
Comment TFM fontdimen 5: 4.3055 (xheight)
Comment TFM fontdimen 6: 10 (quad)
Comment TFM fontdimen 7: 1.11111 (extra space)
Comment TFM fontdimen 8: 6.833 (non-standard: uc height)
Comment TFM fontdimen 9: 6.9445 (non-standard: ascender)
Comment TFM fontdimen 10: 11.27 (non-standard: accented cap height)
Comment TFM fontdimen 11: 1.94443 (non-standard: descender depth)
Comment TFM fontdimen 12: 11.27 (non-standard: max height)
Comment TFM fontdimen 13: 2.9 (non-standard: max depth)
Comment TFM fontdimen 14: 5 (non-standard: digit width)
Comment TFM fontdimen 15: 0.88889 (non-standard: uc stem)
Comment TFM fontdimen 16: 12 (non-standard: baselineskip)
Comment TFM fontdimen 17: 0.69444 (non-standard: lc stem)
Comment TFM fontdimen 18: 0.55556 (non-standard: u, i.e., font unit)
Comment TFM fontdimen 19: 0.22223 (non-standard: overshoot)
Comment TFM fontdimen 20: 0.25 (non-standard: thin stem, hair)
Comment TFM fontdimen 21: 0.30556 (non-standard: cap thin stem, i.e., cap_hair)
Comment TFM headerbyte 9: FontSpecific
Comment TFM headerbyte 49: LMRoman10
Comment TFM headerbyte 72: 234
...
--- lmcsc10.afm ---
StartFontMetrics 2.0
Comment Generated by MetaType1 (a MetaPost-based engine)
...
FontName LMRomanCaps10-Regular
FullName LMRomanCaps10-Regular
FamilyName LMRomanCaps10
Weight Normal
ItalicAngle 0
IsFixedPitch false
UnderlinePosition -146
UnderlineThickness 40
Version 2.004
EncodingScheme FontSpecific
FontBBox -496 -290 1501 1100
CapHeight 683.33333
XHeight 513.88889
Descender -194.44444
Ascender 694.44444
Comment PFM parameters: LMRomanCaps10 0 0 0xEE
Comment TFM designsize: 10 (in points)
Comment TFM fontdimen 1: 0 (slant)
Comment TFM fontdimen 2: 3.77774 (space)
Comment TFM fontdimen 3: 1.75 (space stretch)
Comment TFM fontdimen 4: 1.16667 (space shrink)
Comment TFM fontdimen 5: 4.3055 (xheight)
Comment TFM fontdimen 6: 11.0555 (quad)
Comment TFM fontdimen 7: 1.16667 (extra space)
Comment TFM fontdimen 8: 6.833 (non-standard: uc height)
Comment TFM fontdimen 9: 6.9445 (non-standard: ascender)
Comment TFM fontdimen 10: 11 (non-standard: accented cap height)
Comment TFM fontdimen 11: 1.94443 (non-standard: descender depth)
Comment TFM fontdimen 12: 11 (non-standard: max height)
Comment TFM fontdimen 13: 2.9 (non-standard: max depth)
Comment TFM fontdimen 14: 5.528 (non-standard: digit width)
Comment TFM fontdimen 15: 0.88889 (non-standard: uc stem)
Comment TFM fontdimen 16: 12 (non-standard: baselineskip)
Comment TFM fontdimen 17: 0.69444 (non-standard: lc stem)
Comment TFM fontdimen 18: 0.58333 (non-standard: u, i.e., font unit)
Comment TFM fontdimen 19: 0.22223 (non-standard: overshoot)
Comment TFM fontdimen 20: 0.25 (non-standard: thin stem, hair)
Comment TFM fontdimen 21: 0.30556 (non-standard: cap thin stem, i.e., cap_hair)
Comment TFM headerbyte 9: FontSpecific
Comment TFM headerbyte 49: LMRomanCaps10
Comment TFM headerbyte 72: 234
...
--- ec-lmr10.tfm (TFM supplied with Latin Modern) ---
(FAMILY LMROMAN10)
(FACE O 352)
(CODINGSCHEME EC ENCODING /CORK/)
(DESIGNSIZE R 10.0)
(COMMENT DESIGNSIZE IS IN POINTS)
(COMMENT OTHER SIZES ARE MULTIPLES OF DESIGNSIZE)
(CHECKSUM O 25640215007)
(FONTDIMEN
(SLANT R 0.0)
(SPACE R 0.333333)
(STRETCH R 0.166667)
(SHRINK R 0.111112)
(XHEIGHT R 0.43055)
(QUAD R 1.0)
(EXTRASPACE R 0.111112)
(PARAMETER D 8 R 0.683299)
(PARAMETER D 9 R 0.69445)
(PARAMETER D 10 R 0.0)
(PARAMETER D 11 R 0.194443)
(PARAMETER D 12 R 0.932001)
(PARAMETER D 13 R 0.289999)
(PARAMETER D 14 R 0.5)
(PARAMETER D 15 R 0.088888)
(PARAMETER D 16 R 1.2)
(PARAMETER D 17 R 0.069445)
(PARAMETER D 18 R 0.055555)
(PARAMETER D 19 R 0.0222225)
(PARAMETER D 20 R 0.025)
(PARAMETER D 21 R 0.030556)
)
--- ec-lmcsc10.tfm (TFM supplied with Latin Modern) ---
(FAMILY LMROMANCAPS10)
(FACE O 352)
(CODINGSCHEME EC ENCODING /CORK/)
(DESIGNSIZE R 10.0)
(COMMENT DESIGNSIZE IS IN POINTS)
(COMMENT OTHER SIZES ARE MULTIPLES OF DESIGNSIZE)
(CHECKSUM O 25042402574)
(FONTDIMEN
(SLANT R 0.0)
(SPACE R 0.377774)
(STRETCH R 0.175)
(SHRINK R 0.116667)
(XHEIGHT R 0.43055)
(QUAD R 1.10555)
(EXTRASPACE R 0.116667)
(PARAMETER D 8 R 0.683299)
(PARAMETER D 9 R 0.69445)
(PARAMETER D 10 R 0.0)
(PARAMETER D 11 R 0.194443)
(PARAMETER D 12 R 0.933001)
(PARAMETER D 13 R 0.289999)
(PARAMETER D 14 R 0.5528)
(PARAMETER D 15 R 0.088888)
(PARAMETER D 16 R 1.2)
(PARAMETER D 17 R 0.069445)
(PARAMETER D 18 R 0.058332)
(PARAMETER D 19 R 0.0222225)
(PARAMETER D 20 R 0.025)
(PARAMETER D 21 R 0.030556)
)
--- clmr8t10.tfm (TFM generated with fontinst) ---
(FAMILY UNSPECIFIED)
(FACE F MRR)
(CODINGSCHEME EXTENDED TEX FONT ENCODING - CFR LM)
(DESIGNSIZE R 10.0)
(COMMENT DESIGNSIZE IS IN POINTS)
(COMMENT OTHER SIZES ARE MULTIPLES OF DESIGNSIZE)
(CHECKSUM O 14304534075)
(FONTDIMEN
(SLANT R 0.0)
(SPACE R 0.333)
(STRETCH R 0.2)
(SHRINK R 0.08)
(XHEIGHT R 0.431)
(QUAD R 1.0)
(EXTRASPACE R 0.08)
(PARAMETER D 8 R 0.683)
(PARAMETER D 9 R 0.694)
(PARAMETER D 10 R 0.892)
(PARAMETER D 11 R 0.194)
(PARAMETER D 12 R 1.127)
(PARAMETER D 13 R 0.29)
(PARAMETER D 14 R 0.5)
(PARAMETER D 15 R 0.0)
(PARAMETER D 16 R 1.2)
)
--- clmcsc8t10.tfm (TFM generated with fontinst) ---
(FAMILY UNSPECIFIED)
(FACE F MRR)
(CODINGSCHEME EXTENDED TEX FONT ENCODING - CFR LM)
(DESIGNSIZE R 10.0)
(COMMENT DESIGNSIZE IS IN POINTS)
(COMMENT OTHER SIZES ARE MULTIPLES OF DESIGNSIZE)
(CHECKSUM O 30552436525)
(FONTDIMEN
(SLANT R 0.0)
(SPACE R 0.378)
(STRETCH R 0.227)
(SHRINK R 0.091)
(XHEIGHT R 0.514)
(QUAD R 1.0)
(EXTRASPACE R 0.091)
(PARAMETER D 8 R 0.683)
(PARAMETER D 9 R 0.694)
(PARAMETER D 10 R 0.892)
(PARAMETER D 11 R 0.194)
(PARAMETER D 12 R 1.1)
(PARAMETER D 13 R 0.29)
(PARAMETER D 14 R 0.553)
(PARAMETER D 15 R 0.0)
(PARAMETER D 16 R 1.2)
)
--- end ---
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; 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}{}
...
--- 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).
Thanks _very_ much,
cfr
> Lars Hellström
>
>
More information about the fontinst
mailing list