[Fontinst] fontinst fontdsize variance?

Lars Hellström Lars.Hellstrom at residenset.net
Mon Feb 1 20:01:32 CET 2016


Karl Berry skrev 2016-01-31 19.13:
[...]
> (MAPFONT D 0 (FONTNAME ecti1440) (FONTDSIZE R 14.4) (FONTAT R 1.0))
> (MAPFONT D 1 (FONTNAME ecrm1440) (FONTDSIZE R 14.4) (FONTAT R 1.0))
>
> That 14.4 is slightly different from the value that's actually in the
> ec*1440.tfm files.  E.g.:
>
> $ tftopl /usr/local/texlive/2015/texmf-dist/fonts/tfm/jknappen/ec/ecti1440.tfm| grep DESIGNSIZE
> ..
> (DESIGNSIZE R 14.399994)
> ..
>
> I believe the result of this discrepancy is warnings from vftovp.  Thus:
>
> $ vptovf ectiup1440.vpl
> $ vftovp ectiup1440.vf>/dev/null
> Design size in VF file being replaced by TFM design size
> Design size in VF file being replaced by TFM design size
> $
>
> I'm afraid Boris and I stopped debugging at this point.  How does
> fontinst compute that fontdsize value?  Can anything be done?

This smells like a rounding issue, does it not? 14.399994pt is 
943718.006784sp, whereas 14.4pt is 943718.4sp. Fontinst treats the 
designsize as a dimen, so upon reading 14.399994pt TeX will store a value of 
943718sp, which is later formatted as 14.4pt -- the shortest decimal 
fraction giving the right sp value. So there are probably two factors 
involved in this issue:
  - the TFM format keeps more than 16 bits after the decimal point in the 
designsize (not sure how many; would need to check the format spec to be 
sure) which is of questionable value,
  - the EC fonts have botched the design size calculation for its 14pt-ish 
size (it's supposed to be 14.4pt exactly).

Since in practice the only thing that is done using the design size is to 
check it for equality, these warnings can be ignored. But could one on the 
fontinst side do anything to avoid them completely? I think so (but whether 
it is worth it is another matter).

Basically, what is causing problems is that the designsize is treated as a 
dimen rather than just copied digit by digit. This happens in two places: 
during PL-to-MTX conversion (designsize appears once in PL, but needs to be 
copied to every \setrawglyph command), and in \vpl_mapfont. In the latter 
case, the conversion via a dimen serves mostly to strip off the unit. So 
yes, from a cursory glance this looks perfectly doable.

Lars Hellström


More information about the fontinst mailing list