annotate kpathsea/magstep.h @ 4337:d56e0d75e7c9 ss-2-1-45

[project @ 2003-02-19 21:20:19 by jwe]
author jwe
date Wed, 19 Feb 2003 21:20:19 +0000
parents faa5d0421460
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2999
faa5d0421460 [project @ 1997-05-23 03:02:09 by jwe]
jwe
parents:
diff changeset
1 /* magstep.h: declaration for magstep fixing.
faa5d0421460 [project @ 1997-05-23 03:02:09 by jwe]
jwe
parents:
diff changeset
2
faa5d0421460 [project @ 1997-05-23 03:02:09 by jwe]
jwe
parents:
diff changeset
3 Copyright (C) 1994 Karl Berry.
faa5d0421460 [project @ 1997-05-23 03:02:09 by jwe]
jwe
parents:
diff changeset
4
faa5d0421460 [project @ 1997-05-23 03:02:09 by jwe]
jwe
parents:
diff changeset
5 This library is free software; you can redistribute it and/or
faa5d0421460 [project @ 1997-05-23 03:02:09 by jwe]
jwe
parents:
diff changeset
6 modify it under the terms of the GNU Library General Public
faa5d0421460 [project @ 1997-05-23 03:02:09 by jwe]
jwe
parents:
diff changeset
7 License as published by the Free Software Foundation; either
faa5d0421460 [project @ 1997-05-23 03:02:09 by jwe]
jwe
parents:
diff changeset
8 version 2 of the License, or (at your option) any later version.
faa5d0421460 [project @ 1997-05-23 03:02:09 by jwe]
jwe
parents:
diff changeset
9
faa5d0421460 [project @ 1997-05-23 03:02:09 by jwe]
jwe
parents:
diff changeset
10 This library is distributed in the hope that it will be useful,
faa5d0421460 [project @ 1997-05-23 03:02:09 by jwe]
jwe
parents:
diff changeset
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
faa5d0421460 [project @ 1997-05-23 03:02:09 by jwe]
jwe
parents:
diff changeset
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
faa5d0421460 [project @ 1997-05-23 03:02:09 by jwe]
jwe
parents:
diff changeset
13 Library General Public License for more details.
faa5d0421460 [project @ 1997-05-23 03:02:09 by jwe]
jwe
parents:
diff changeset
14
faa5d0421460 [project @ 1997-05-23 03:02:09 by jwe]
jwe
parents:
diff changeset
15 You should have received a copy of the GNU Library General Public
faa5d0421460 [project @ 1997-05-23 03:02:09 by jwe]
jwe
parents:
diff changeset
16 License along with this library; if not, write to the Free Software
faa5d0421460 [project @ 1997-05-23 03:02:09 by jwe]
jwe
parents:
diff changeset
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
faa5d0421460 [project @ 1997-05-23 03:02:09 by jwe]
jwe
parents:
diff changeset
18
faa5d0421460 [project @ 1997-05-23 03:02:09 by jwe]
jwe
parents:
diff changeset
19 #ifndef KPATHSEA_MAGSTEP_H
faa5d0421460 [project @ 1997-05-23 03:02:09 by jwe]
jwe
parents:
diff changeset
20 #define KPATHSEA_MAGSTEP_H
faa5d0421460 [project @ 1997-05-23 03:02:09 by jwe]
jwe
parents:
diff changeset
21
faa5d0421460 [project @ 1997-05-23 03:02:09 by jwe]
jwe
parents:
diff changeset
22 #include <kpathsea/c-proto.h>
faa5d0421460 [project @ 1997-05-23 03:02:09 by jwe]
jwe
parents:
diff changeset
23 #include <kpathsea/types.h>
faa5d0421460 [project @ 1997-05-23 03:02:09 by jwe]
jwe
parents:
diff changeset
24
faa5d0421460 [project @ 1997-05-23 03:02:09 by jwe]
jwe
parents:
diff changeset
25 /* If DPI is close enough to some magstep of BDPI, return the true dpi
faa5d0421460 [project @ 1997-05-23 03:02:09 by jwe]
jwe
parents:
diff changeset
26 value, and the magstep found (or zero) in M_RET (if
faa5d0421460 [project @ 1997-05-23 03:02:09 by jwe]
jwe
parents:
diff changeset
27 non-null). ``Close enough'' means within one pixel.
faa5d0421460 [project @ 1997-05-23 03:02:09 by jwe]
jwe
parents:
diff changeset
28
faa5d0421460 [project @ 1997-05-23 03:02:09 by jwe]
jwe
parents:
diff changeset
29 M_RET is slightly encoded: the least significant bit is on for a
faa5d0421460 [project @ 1997-05-23 03:02:09 by jwe]
jwe
parents:
diff changeset
30 half-magstep, off otherwise. Thus, a returned M_RET of 1 means
faa5d0421460 [project @ 1997-05-23 03:02:09 by jwe]
jwe
parents:
diff changeset
31 \magstephalf, i.e., sqrt(1.2), i.e., 1.09544. Put another way,
faa5d0421460 [project @ 1997-05-23 03:02:09 by jwe]
jwe
parents:
diff changeset
32 return twice the number of magsteps.
faa5d0421460 [project @ 1997-05-23 03:02:09 by jwe]
jwe
parents:
diff changeset
33
faa5d0421460 [project @ 1997-05-23 03:02:09 by jwe]
jwe
parents:
diff changeset
34 In practice, this matters for magstephalf. Floating-point computation
faa5d0421460 [project @ 1997-05-23 03:02:09 by jwe]
jwe
parents:
diff changeset
35 with the fixed-point DVI representation leads to 328 (for BDPI ==
faa5d0421460 [project @ 1997-05-23 03:02:09 by jwe]
jwe
parents:
diff changeset
36 300); specifying `at 11pt' yields 330; the true \magstephalf is 329
faa5d0421460 [project @ 1997-05-23 03:02:09 by jwe]
jwe
parents:
diff changeset
37 (that's what you get if you run Metafont with mag:=magstep(.5)).
faa5d0421460 [project @ 1997-05-23 03:02:09 by jwe]
jwe
parents:
diff changeset
38
faa5d0421460 [project @ 1997-05-23 03:02:09 by jwe]
jwe
parents:
diff changeset
39 The time to call this is after you read the font spec from the DVI
faa5d0421460 [project @ 1997-05-23 03:02:09 by jwe]
jwe
parents:
diff changeset
40 file, but before you look up any files -- do the usual floating-point
faa5d0421460 [project @ 1997-05-23 03:02:09 by jwe]
jwe
parents:
diff changeset
41 computations, and then fix up the result. */
faa5d0421460 [project @ 1997-05-23 03:02:09 by jwe]
jwe
parents:
diff changeset
42
faa5d0421460 [project @ 1997-05-23 03:02:09 by jwe]
jwe
parents:
diff changeset
43 extern unsigned kpse_magstep_fix P3H(unsigned dpi, unsigned bdpi, int *m_ret);
faa5d0421460 [project @ 1997-05-23 03:02:09 by jwe]
jwe
parents:
diff changeset
44
faa5d0421460 [project @ 1997-05-23 03:02:09 by jwe]
jwe
parents:
diff changeset
45 #endif /* not KPATHSEA_MAGSTEP_H */