title: Scaling pixelvalues for printing
body: <p>I'm trying to find some sense in some old code related to printing. </p>
  
  <p>When drawing a form to the printer, every size and position property get multiplied by a scale factor. The factor is calculated by the following code:</p>
  
  <pre><code>    { Printer device-specific information }
      FXScale := (GetDeviceCaps(Printer.Handle, LOGPIXELSX)/96) -
                 ((2-(GetDeviceCaps(Printer.Handle, HORZRES)*2) /
                 GetDeviceCaps(Printer.Handle, PHYSICALWIDTH)));
      FYScale := (GetDeviceCaps(Printer.Handle, LOGPIXELSY)/96) -
                 ((2-(GetDeviceCaps(Printer.Handle, VERTRES)*2) /
                 GetDeviceCaps(Printer.Handle, PHYSICALHEIGHT)));
  </code></pre>
  
  <p>Can anyone explain what is happending here? I guess there is some mapping between screen resolution and printer resolution, but what about the rest? Why the 2's?</p>