title: Scaling Handled Differently in Java and Eclipse Framework
body: <p>We have a problem using <a href="https://www.eclipse.org/nebula/widgets/paperclips/paperclips.php" rel="nofollow noreferrer">Paperclips</a> (printing library for SWT) on scaled monitors, but I don't think it has anything to do with the framework and all with the Eclipse environment.</p>
  
  <p>Let's see an example:</p>
  
  <p><a href="https://i.stack.imgur.com/3CQk2.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/3CQk2.png" alt="enter image description here"></a></p>
  
  <p>Left is the print with no scaling (or 100%), right is the same print started on a monitor with 175% scaling. I know what you are thinking: the monitor and its resolution / scaling should have no influence on a print. Right, <em>should.</em></p>
  
  <p>While that's sad and all, it would not be much of a problem. But there comes the kicker: The above prints were generated by a JUnit test case run as plug-in test. If I run them as a regular unit test <strong>both</strong> work.</p>
  
  <p>Clearly something in the Eclipse environment works differently when started in an OSGi context, and I'm trying to find out what it is (so I can maybe prevent it). </p>
  
  <p>And I think that's a nice puzzle.</p>
  
  <p>If you need a hint for what SWT class might be the , I narrowed it down to this file <a href="https://github.com/eclipse/nebula/blob/master/widgets/paperclips/org.eclipse.nebula.paperclips.core/src/org/eclipse/nebula/paperclips/core/ScalePrint.java" rel="nofollow noreferrer"><code>ScalePrint.java</code></a> for the table (i.e if I remove the instance of <code>ScalePrint</code> from my demo, the table is displayed correctly; the header is still wrong, though). </p>
  
  <p>I can confirm the error exists only in Eclipse 4.6, and not 4.5 or 3.7 (which is not entirely surprising, since 4.6 is the first version to support scaling). And if I add <code>-Dswt.autoScale=100</code> to the VM options to disable scaling, it works as expected, too.</p>
  
  <p>I could append my test case, but as I said, I don't really think it has anything to do with Paperclips per se. </p>
  
  <p>So... what could break the scaling when the entire Eclipse framework is started compared to running the same code in a plain Java application?</p>