bug in fontinst 1.801: rounding problems (was: duplicated ker
nings)
Lars Hellström
Lars.Hellstrom@math.umu.se
Mon, 5 Oct 1998 13:19:28 +0100 (MET)
Alan Jeffrey wrote:
>Gosh, what a remarkable bit of detective work, well done!
>
Actually, it was pure luck. I happend to be looking at that part of
fontinst, when a sudden "Waaaiiit a minute! What if ..." struck me. I might
have found the murder weapon, but the murderer is still to be caught.
>I guess the question is now what the fix is: peraps all generations of
>MAPFONT should go through the `divide by 8 multiply by 8 again' routine to
>make sure they're all rounded. This won't make any difference to dimens
>that have gone through the process, and will round others appropriately.
>
Actually, I would prefer it if scalings with a factor of 1000 were not made
at all. Not scaling uses less of TeX's memory and is most likely faster.
Vladimir Volovich wrote:
>btw, why scaling with factor 1000 occurs in the first place? :-) it
>was not requested in the test file which demonstrates a bug (and in ae
>fonts too).
Many of the metric commands requires a scaling factor. If you want to make
a glyph punctdash that is the same thing as emdash (latin.mtx does this),
you have to write
\setglyph{punctdash}
\glyph{emdash}{1000}
\endsetglyph
This is where the scaling sneaks in.
Rowland wrote:
>Not all of us have access to present-day processors, you know.
As "present-day processors" was used, I believe the even the 68LC040 would
qualify with a margin. Its ancestor 68000 probably would not.
Finally, I would like to point out that we might also consider doing
scaling with some kind of multiple word arthimetic. To me, it seems like
\def\int_scale#1#2{
% #1 is a \count register whose contents should be scaled.
% #2 is the scaling factor. I assume it is a valid TeX <number>,
% rather than a fontinst <integer expression>.
\a_count=#1
\b_count=\a_count
\divide \a_count 10000
\c_count=\a_count
\multiply \c_count 10000
\advance \b_count -\c_count
\multiply \a_count #2
\multiply \b_count #2
\multiply \a_count 10
\divide \b_count 1000 % One could do something fancier here, to
% achieve proper rounding rather than mere
% truncation.
\advance \a_count \b_count
#1=\a_count
}
would pretty much do the trick.
Lars Hellström