diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/GC.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/GC.java index 59d1cd0de9f..0fdc863a15e 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/GC.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/GC.java @@ -5877,7 +5877,7 @@ void apply() { */ public Point stringExtent (String string) { if (string == null) SWT.error (SWT.ERROR_NULL_ARGUMENT); - return Win32DPIUtils.pixelToPointAsSize(drawable, stringExtentInPixels(string), getZoom()); + return Win32DPIUtils.pixelToPointAsSufficientlyLargeSize(drawable, stringExtentInPixels(string), getZoom()); } Point stringExtentInPixels (String string) { @@ -5922,7 +5922,7 @@ Point stringExtentInPixels (String string) { * */ public Point textExtent (String string) { - return Win32DPIUtils.pixelToPointAsSize(drawable, textExtentInPixels(string, SWT.DRAW_DELIMITER | SWT.DRAW_TAB), getZoom()); + return textExtent(string, SWT.DRAW_DELIMITER | SWT.DRAW_TAB); } /** @@ -5957,7 +5957,7 @@ public Point textExtent (String string) { * */ public Point textExtent (String string, int flags) { - return Win32DPIUtils.pixelToPointAsSize(drawable, textExtentInPixels(string, flags), getZoom()); + return Win32DPIUtils.pixelToPointAsSufficientlyLargeSize(textExtentInPixels(string, flags), getZoom()); } Point textExtentInPixels(String string, int flags) { diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/Win32DPIUtils.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/Win32DPIUtils.java index 9263b5de6df..af869f40d0e 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/Win32DPIUtils.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/Win32DPIUtils.java @@ -137,6 +137,11 @@ public static Point pixelToPointAsSize(Drawable drawable, Point point, int zoom) return pixelToPointAsSize (point, zoom); } + public static Point pixelToPointAsSufficientlyLargeSize(Drawable drawable, Point point, int zoom) { + if (drawable != null && !drawable.isAutoScalable()) return point; + return pixelToPointAsSufficientlyLargeSize (point, zoom); + } + public static Point pixelToPointAsLocation(Drawable drawable, Point point, int zoom) { if (drawable != null && !drawable.isAutoScalable()) return point; return pixelToPointAsLocation (point, zoom);