[Kst] extragear/graphics/kst/src/libkstmath

Andrew Walker arwalker at sumusltd.com
Fri Jun 2 21:15:54 CEST 2006

```SVN commit 547619 by arwalker:

modify the value used to determine the scaling factor, and explain its significance

M  +15 -1     kstpainter.cpp

--- trunk/extragear/graphics/kst/src/libkstmath/kstpainter.cpp #547618:547619
@@ -62,7 +62,21 @@
if (type() == P_PRINT || type() == P_EXPORT) {
const QRect& w(window());

-    factor = (w.width() + w.height()) / 800;
+    //
+    // we want a line width of 1 to give a width of approximately 1 pt (where 1 pt = 1/72
+    //  inch) when printing on letter sized paper. Assuming a margin of 0.25 inch in one
+    //  direction (on both sides) and 0.5 inch in the other direction (again on both sides)
+    //  and a printer resolution of 600 dpi:
+    //
+    //  w.width() + w.height() = ( 8 + 11 - ( 2 * 0.5 ) - ( 2 * 0.25 ) ) * 600 = 10500
+    //
+    //  we want a scale factor of 600/72 = 8.333 in the line width, so our magic number simply
+    //  becomes:
+    //
+    //  w.width() + w.height() / scale factor = 10200 / 8.333 ~ 1300
+    //
+
+    factor = (w.width() + w.height()) / 1300;
}

return factor > 0 ? factor : 1;
```