X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=bundles%2Forg.simantics.g2d%2Fsrc%2Forg%2Fsimantics%2Fg2d%2Futils%2FFontHelper.java;fp=bundles%2Forg.simantics.g2d%2Fsrc%2Forg%2Fsimantics%2Fg2d%2Futils%2FFontHelper.java;h=98d5c78f664759653e2a5ffad20cbf7600da24af;hp=06bd80aa8e027c45a971de4b179bf1899c3e38c6;hb=181013801c831415efe3cfe346546b5ab62c3214;hpb=ad5b573b5db77a3e00429fc24e2de855bce7f48a diff --git a/bundles/org.simantics.g2d/src/org/simantics/g2d/utils/FontHelper.java b/bundles/org.simantics.g2d/src/org/simantics/g2d/utils/FontHelper.java index 06bd80aa8..98d5c78f6 100644 --- a/bundles/org.simantics.g2d/src/org/simantics/g2d/utils/FontHelper.java +++ b/bundles/org.simantics.g2d/src/org/simantics/g2d/utils/FontHelper.java @@ -12,11 +12,11 @@ package org.simantics.g2d.utils; import java.awt.Font; -import java.awt.Toolkit; import org.eclipse.jface.resource.FontRegistry; import org.eclipse.swt.graphics.FontData; import org.eclipse.ui.PlatformUI; +import org.simantics.utils.ui.SWTDPIUtil; public final class FontHelper { @@ -35,8 +35,7 @@ public final class FontHelper { } public static java.awt.Font toAwt(FontData fd) { - int resolution = Toolkit.getDefaultToolkit().getScreenResolution(); - int awtFontSize = (int) Math.round((double) fd.getHeight() * resolution / 72.0); + int awtFontSize = SWTDPIUtil.upscaleSwt(fd.getHeight()); // The style constants for SWT and AWT map exactly, and since they are int constants, they should // never change. So, the SWT style is passed through as the AWT style. Font font = new java.awt.Font(fd.getName(), fd.getStyle(), awtFontSize);