From 758007a109329d5c4686d675509d96c4dd606569 Mon Sep 17 00:00:00 2001 From: jsimomaa Date: Wed, 6 Mar 2019 22:13:54 +0200 Subject: [PATCH] Some initial fixes for DPI in map nodes (lot's TODO still) gitlab #36 Change-Id: If7022ea127d595ea6eaa89878fce38212c81734f --- .../src/org/simantics/maps/sg/MapAttributionNode.java | 7 +++++-- .../src/org/simantics/maps/sg/MapLocationZoomInfoNode.java | 4 +++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/org.simantics.district.maps/src/org/simantics/maps/sg/MapAttributionNode.java b/org.simantics.district.maps/src/org/simantics/maps/sg/MapAttributionNode.java index 66543aac..d97d22eb 100644 --- a/org.simantics.district.maps/src/org/simantics/maps/sg/MapAttributionNode.java +++ b/org.simantics.district.maps/src/org/simantics/maps/sg/MapAttributionNode.java @@ -10,6 +10,7 @@ import java.awt.geom.AffineTransform; import java.awt.geom.Rectangle2D; import org.simantics.scenegraph.g2d.G2DNode; +import org.simantics.scenegraph.utils.DPIUtil; public class MapAttributionNode extends G2DNode { @@ -33,7 +34,7 @@ public class MapAttributionNode extends G2DNode { g2d.setTransform(new AffineTransform()); // do the rendering magic - Font rulerFont = new Font("Tahoma", Font.PLAIN, 9); + Font rulerFont = new Font("Tahoma", Font.PLAIN, DPIUtil.upscale(9)); //g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2d.setStroke(new BasicStroke(1)); @@ -43,7 +44,9 @@ public class MapAttributionNode extends G2DNode { if (bounds == null) return; // FIXME - String str = "Map data © OpenStreetMap contributors"; + String str = "Map data \u00A9 OpenStreetMap contributors"; + + g2d.setFont(rulerFont); FontMetrics fm = g2d.getFontMetrics(); Rectangle2D r = fm.getStringBounds(str, g2d); diff --git a/org.simantics.district.maps/src/org/simantics/maps/sg/MapLocationZoomInfoNode.java b/org.simantics.district.maps/src/org/simantics/maps/sg/MapLocationZoomInfoNode.java index bad499e6..9e027ecb 100644 --- a/org.simantics.district.maps/src/org/simantics/maps/sg/MapLocationZoomInfoNode.java +++ b/org.simantics.district.maps/src/org/simantics/maps/sg/MapLocationZoomInfoNode.java @@ -15,6 +15,7 @@ import org.simantics.g2d.participant.MouseUtil; import org.simantics.g2d.participant.MouseUtil.MouseInfo; import org.simantics.maps.MapScalingTransform; import org.simantics.scenegraph.g2d.G2DNode; +import org.simantics.scenegraph.utils.DPIUtil; public class MapLocationZoomInfoNode extends G2DNode { @@ -40,7 +41,7 @@ public class MapLocationZoomInfoNode extends G2DNode { g2d.setTransform(new AffineTransform()); // do the rendering magic - Font rulerFont = new Font("Tahoma", Font.PLAIN, 9); + Font rulerFont = new Font("Tahoma", Font.PLAIN, DPIUtil.upscale(9)); //g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2d.setStroke(new BasicStroke(1)); @@ -68,6 +69,7 @@ public class MapLocationZoomInfoNode extends G2DNode { } String str = "X: " + formatValue(startLon, MAX_DIGITS) + ", Y: " + formatValue(startLat, MAX_DIGITS) + ", Z: " + zoomLevel; + g2d.setFont(rulerFont); FontMetrics fm = g2d.getFontMetrics(); Rectangle2D r = fm.getStringBounds(str, g2d); -- 2.47.1