(DPI) Scaling fonts in Java Swing (and Windows)
<p>I'm trying to manually scale some fonts in my Java Swing application (ie. for a high res screen).</p>

<p>at 96 DPI (100%), Windows Look &amp; Feel tells me the default font is Tahoma size 11. (using Label.font in the WLF)
At 200% it's 21, 300% is 32, 400% is 43, and 500% is 53. (note that point size == font ascent)</p>

<p>My original approach is to take "my" default font: Tahoma size 11. Then calculate the scaling factor (ie. 2.0 for 200%). From there I want to calculate the font point size, however doing a straight up multiplication isn't in line with the Windows scaling,</p>

<p>so the question(s):</p>

<ol>
<li>How does font scaling work in Windows?
and</li>
<li><p>How do I scale my fonts? (There is also other scaling done for components, etc.)
The two main fonts in my application are Tahoma(11) and Segoe UI (12).</p>

<pre><code>new WindowsLookAndFeel().getDefaults().getFont("Label.font") //returns 11 @ 100%

Font font = StyleContext.getDefaultStyleContext().getFont("Tahoma",  Font.PLAIN, 11); //my inital Composite font (Tahoma with Dialog fallback)

Font newFont = font.deriveFont(zoomFactor * 11); // this gets me 22 @ 200%
</code></pre></li>
</ol>

<p>Thanks!</p>