Skip to content

Commit 2ac9121

Browse files
HeikoKlareakoch-yatta
authored andcommitted
[Win32] Fix wrong line height in StyledText #2405
The line height in StyledText is currently too large when the auto-scaled device zoom is larger than the native zoom. This for example happens on a 175% primary monitor with `swt.autoScale=int200` or with a fixed `swt.autoScale` value that is higher than the primary monitor zoom. This was caused by a recent change that accidentally used the auto-scaled zoom instead of the native zoom for retrieving a font handle combined with the general usage of the ScalingSWTFontRegistry that, in comparison to the previous fixed-zoom registry, now returns an accordingly scaled handle. This change adapts the font handle retrieval to properly pass the native zoom instead of the auto-scaled zoom. Fixes #2405
1 parent e2ac7f1 commit 2ac9121

File tree

1 file changed

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

1 file changed

+1
-1
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2135,7 +2135,7 @@ public FontMetrics getLineMetrics (int lineIndex) {
21352135
long srcHdc = OS.CreateCompatibleDC(hDC);
21362136
TEXTMETRIC lptm = new TEXTMETRIC();
21372137
final int zoom = getZoom();
2138-
long availableFont = font != null ? SWTFontProvider.getFontHandle(font, zoom) : SWTFontProvider.getSystemFontHandle(device, zoom);
2138+
long availableFont = font != null ? SWTFontProvider.getFontHandle(font, nativeZoom) : SWTFontProvider.getSystemFontHandle(device, nativeZoom);
21392139
OS.SelectObject(srcHdc, availableFont);
21402140
metricsAdapter.GetTextMetrics(srcHdc, lptm);
21412141
OS.DeleteDC(srcHdc);

0 commit comments

Comments
 (0)