[312723] Fonts broken on Export to Image and Printing
- Revert parts of previous changes (use hardcoded 96dpi), which caused issues on MacOS
see discussion in the bug.
- Make the DPI used overridable through a system property in case the
computation does not work as expected in some configurations (OS,
SWT version, actual screen DPI and zoom factor, etc.).
- Increase version number from 1.8.0 to 1.8.1
Signed-off-by: Ansgar Radermacher <ansgar.radermacher@cea.fr>
Signed-off-by: Pierre-Charles David <pierre-charles.david@obeo.fr>
Change-Id: If93348667b76f32e918d7365b554e54bf85c0b9f
diff --git a/org.eclipse.gmf.runtime.draw2d.ui.render.awt/META-INF/MANIFEST.MF b/org.eclipse.gmf.runtime.draw2d.ui.render.awt/META-INF/MANIFEST.MF
index abe55e4..88c07bd 100644
--- a/org.eclipse.gmf.runtime.draw2d.ui.render.awt/META-INF/MANIFEST.MF
+++ b/org.eclipse.gmf.runtime.draw2d.ui.render.awt/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@
Bundle-ManifestVersion: 2
Bundle-Name: %Plugin.name
Bundle-SymbolicName: org.eclipse.gmf.runtime.draw2d.ui.render.awt;singleton:=true
-Bundle-Version: 1.8.0.qualifier
+Bundle-Version: 1.8.1.qualifier
Bundle-Activator: org.eclipse.gmf.runtime.draw2d.ui.render.awt.internal.Draw2dRenderPlugin
Bundle-Vendor: %Plugin.providerName
Bundle-Localization: plugin
diff --git a/org.eclipse.gmf.runtime.draw2d.ui.render.awt/pom.xml b/org.eclipse.gmf.runtime.draw2d.ui.render.awt/pom.xml
index 1c2ccc9..21cd7e9 100644
--- a/org.eclipse.gmf.runtime.draw2d.ui.render.awt/pom.xml
+++ b/org.eclipse.gmf.runtime.draw2d.ui.render.awt/pom.xml
@@ -10,6 +10,6 @@
</parent>
<groupId>org.eclipse.gmf.runtime.draw2d.ui.render.awt</groupId>
<artifactId>org.eclipse.gmf.runtime.draw2d.ui.render.awt</artifactId>
- <version>1.8.0-SNAPSHOT</version>
+ <version>1.8.1-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project>
diff --git a/org.eclipse.gmf.runtime.draw2d.ui.render.awt/src/org/eclipse/gmf/runtime/draw2d/ui/render/awt/internal/graphics/GraphicsToGraphics2DAdaptor.java b/org.eclipse.gmf.runtime.draw2d.ui.render.awt/src/org/eclipse/gmf/runtime/draw2d/ui/render/awt/internal/graphics/GraphicsToGraphics2DAdaptor.java
index 594e324..bbc2ed6 100644
--- a/org.eclipse.gmf.runtime.draw2d.ui.render.awt/src/org/eclipse/gmf/runtime/draw2d/ui/render/awt/internal/graphics/GraphicsToGraphics2DAdaptor.java
+++ b/org.eclipse.gmf.runtime.draw2d.ui.render.awt/src/org/eclipse/gmf/runtime/draw2d/ui/render/awt/internal/graphics/GraphicsToGraphics2DAdaptor.java
@@ -1,5 +1,5 @@
/******************************************************************************
- * Copyright (c) 2004, 2015 IBM Corporation and others.
+ * Copyright (c) 2004, 2015, 2021 IBM Corporation and others.
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
@@ -7,7 +7,8 @@
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
- * IBM Corporation - initial API and implementation
+ * IBM Corporation - initial API and implementation
+ * Ansgar Radermacher - bug 312723, revert parts of initial changes for this issue
****************************************************************************/
@@ -1074,9 +1075,8 @@
int height = fontInfo[0].getHeight();
- float fsize = (float) height
- * 96.0f / 72.0f; // default display DPI / default DPI of AWT
-
+ int dpi = Integer.getInteger("org.eclipse.gmf.runtime.draw2d.ui.render.dpi", DisplayUtils.getDisplay().getDPI().x);
+ float fsize = (float) height * (float) dpi / 72.0f; // display DPI / AWT DPI
height = (int) fsize;
int style = fontInfo[0].getStyle();