summaryrefslogtreecommitdiff
path: root/Build/source/texk/seetexk/conv.c
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2006-01-17 21:41:51 +0000
committerKarl Berry <karl@freefriends.org>2006-01-17 21:41:51 +0000
commit487ca4806cc046076293cf6cc5fbba0db282bac7 (patch)
tree847b412ab5158dd7bdd7ed7e5a4cc3fbca94be32 /Build/source/texk/seetexk/conv.c
parenta3d3111bfe26b8e5f5bc6049dfb2a4ca2edc7881 (diff)
texk 1
git-svn-id: svn://tug.org/texlive/trunk@1485 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/seetexk/conv.c')
-rw-r--r--Build/source/texk/seetexk/conv.c52
1 files changed, 52 insertions, 0 deletions
diff --git a/Build/source/texk/seetexk/conv.c b/Build/source/texk/seetexk/conv.c
new file mode 100644
index 00000000000..f2b096e8ddd
--- /dev/null
+++ b/Build/source/texk/seetexk/conv.c
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 1987, 1989 University of Maryland
+ * Department of Computer Science. All rights reserved.
+ * Permission to copy for any purpose is hereby granted
+ * so long as this copyright notice remains intact.
+ */
+
+#ifndef lint
+static char rcsid[] = "$Header: /usr/src/local/tex/local/mctex/lib/RCS/conv.c,v 3.1 89/08/22 21:48:01 chris Exp $";
+#endif
+
+/*
+ * Conversions.
+ */
+
+#include "types.h"
+#include "conv.h"
+
+double DMagFactor();
+
+Conv Conversion; /* the global conversion */
+
+/*
+ * Set a conversion (possibly the global conversion).
+ */
+void
+CSetConversion(c, dpi, usermag, num, denom, dvimag)
+ register struct conversion *c;
+ int dpi, usermag;
+ i32 num, denom, dvimag;
+{
+ double ddpi = dpi;
+
+ c->c_mag = DMagFactor((int) dvimag) * DMagFactor(usermag);
+ c->c_dpi = ddpi;
+
+ /*
+ * The conversion facture is figured as follows: there are exactly
+ * num/denom DVI units per decimicron, and 254000 decimicrons per
+ * inch, and dpi pixels per inch. Then we have to adjust this by
+ * the stated magnification.
+ */
+ c->c_fromsp = (num / 254000.0) * (ddpi / denom) * c->c_mag;
+
+ /*
+ * c->c_tosp is 1/c->c_fromsp, but we will invert the expression
+ * above in the hopes of some extra accuracy.
+ *
+ * IS THIS ANY GOOD? I NEED A NUMERICAL ANALYST!
+ */
+ c->c_tosp = (254000.0 / num) * (denom / ddpi) * (1.0 / c->c_mag);
+}