Skip to content

Commit c8d98fb

Browse files
committed
Change calculation of primary monitor zoom to prevent threading issues with fonts
1 parent d25d2f6 commit c8d98fb

File tree

1 file changed

+3
-3
lines changed
  • bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics

1 file changed

+3
-3
lines changed

bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Font.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -214,13 +214,13 @@ public FontData[] getFontData() {
214214
LOGFONT logFont = new LOGFONT ();
215215
OS.GetObject(handle, LOGFONT.sizeof, logFont);
216216
float heightInPoints = device.computePoints(logFont, handle);
217-
int primaryZoom = device.getDeviceZoom();
217+
int primaryZoom = DPIUtil.mapDPIToZoom (device._getDPIx());
218218
float zoomFactor;
219219
if (zoomLevel != primaryZoom) {
220220
// as Device::computePoints will always return point on the basis of the
221221
// primary monitor zoom, a custom zoomFactor must be calculated if the font
222222
// is used for a different zoom level
223-
zoomFactor = 1.0f * device.getDeviceZoom() / zoomLevel;
223+
zoomFactor = 1.0f * primaryZoom / zoomLevel;
224224
} else {
225225
zoomFactor = 1.0f;
226226
}
@@ -309,7 +309,7 @@ private static int extractZoomLevel(Device device) {
309309
if (device == null) {
310310
DPIUtil.getNativeDeviceZoom();
311311
}
312-
return device.getDeviceZoom();
312+
return DPIUtil.mapDPIToZoom (device._getDPIx());
313313
}
314314

315315
/**

0 commit comments

Comments
 (0)