Skip to content

Commit 6b20ce2

Browse files
akoch-yattaHeikoKlare
authored andcommitted
[win32] fix for rounding issues when scaling fonts
This commit fixes the calculation of the height when scaling a font for a different zoom when monitor-specific scaling is active
1 parent 9ce68ae commit 6b20ce2

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/ScalingSWTFontRegistry.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,7 @@ private Font getScaledFont(int targetZoom) {
5454
private Font scaleFont(int zoom) {
5555
FontData fontData = baseFont.getFontData()[0];
5656
int baseZoom = computeZoom(fontData);
57-
int zoomScaleFactor = Math.round(1.0f * zoom / baseZoom);
58-
fontData.data.lfHeight *= zoomScaleFactor;
57+
fontData.data.lfHeight = Math.round(1.0f * fontData.data.lfHeight * zoom / baseZoom);
5958
Font scaledFont = Font.win32_new(device, fontData, zoom);
6059
addScaledFont(zoom, scaledFont);
6160
return scaledFont;

0 commit comments

Comments
 (0)