[email protected] skrev:
On Mon 24th May, 2010 at 17:41, Lars Hellström seems to have written:
[email protected] skrev:
On Mon 24th May, 2010 at 12:19, Lars Hellström seems to have written:
[snip]
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.
But surely that would not be limited to the small caps fonts? I'd have
thought in that case I'd see misplaced accents in all cases and not
just when using small caps.
The misplaced accents are due to differences in xheight (fontdimen 5),
and for that the AFM comments agree with the TFM (whereas the AFM
XHeight value that fontinst uses does not). The cases where AFM
comments and TFM did not agree were acccapheight (fontdimen 10) and
maxheight (fontdimen 12), but those aren't involved in accent placement
(unless you use a macro package which queries \fontdimen explicitly).
[snip]
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:
\installfont{clmcsc8t10}{%
\metrics \setint{xheight}{431},lmcsc8ttl10,newlatin%
}{t1-clm}{T1}{clm}{m}{sc}{}
To take all fontdimens but nothing else from ec-lmcsc10, a classical
trick would be to go
\installfont{clmcsc8t10}{%
glyphoff,kernoff,ec-lmcsc10,kernon,glyphon,%
lmcsc8ttl10,newlatin%
}{t1-clm}{T1}{clm}{m}{sc}{}
Ah. That looks very useful - I've never been sure what those commands
were really for. Although in this case, it may be easier to use a
separate mtx file as I can use it in all of the relevant fontinst
lines which might involve marginally less typing!
but an alternative can be
\installfont{clmcsc8t10}{%
ec-lmcsc10 encoding txtfdmns,lmcsc8ttl10,newlatin%
}{t1-clm}{T1}{clm}{m}{sc}{}
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.
Am I right to think that this would ignore all the fontdimens given in
lmcsc8ttl10 and use those given in ec-lmcsc10 instead?
Yes.
That sounds like
it might be the ideal way to go. What format would I need ec-lmcsc10 in
for that to work? Will the PL file (from the TFM) work?
Yes. (The encoding modifier excludes AFM and MTX files from
consideration.)
--- 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.
Still seems weird it would create a problem for the small caps but not
the other shapes. I was thinking that some of the other values looked
to be different but can't remember what I was thinking of now. Except
for fontdimen 10 which is mysteriously set at zero in the TFMs. (At
least, it is mysterious to me...)
Indeed it is! That's probably a bug in the TFMs. And the AFM value is
probably greater than what is correct for this set of glyphs. Your best
bet might be to let fontinst use its heuristic (\height{Aring}), then:
\installfont{clmcsc8t10}{%
ec-lmcsc10 encoding txtfdmns,lmcsc8ttl10,%
\metrics\unsetint{acccapheight},newlatin%
}{t1-clm}{T1}{clm}{m}{sc}{}
Lars Hellström