Skip to content

Commit e92a164

Browse files
committed
Revert usage of getZoom() when calculating TextExtent
This issue reverts the behavior of GC::textExtent to use the GC::getZoom() instead of the zoom from the font as this results in a regression. Fixes #2361
1 parent 13934ee commit e92a164

File tree

2 files changed

+22
-2
lines changed

2 files changed

+22
-2
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/*******************************************************************************
2+
* Copyright (c) 2025 Yatta Solutions
3+
*
4+
* This program and the accompanying materials
5+
* are made available under the terms of the Eclipse Public License 2.0
6+
* which accompanies this distribution, and is available at
7+
* https://www.eclipse.org/legal/epl-2.0/
8+
*
9+
* SPDX-License-Identifier: EPL-2.0
10+
*
11+
* Contributors:
12+
* Yatta Solutions - initial API and implementation
13+
*******************************************************************************/
14+
package org.eclipse.swt.internal;
15+
16+
public class SWTInternalConstants {
17+
18+
public static boolean strictChecks = System.getProperty("org.eclipse.swt.internal.enableStrictChecks") != null;
19+
20+
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5725,7 +5725,7 @@ void apply() {
57255725
*/
57265726
public Point stringExtent (String string) {
57275727
if (string == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
5728-
return Win32DPIUtils.pixelToPoint(drawable, stringExtentInPixels(string), data.font.zoom);
5728+
return Win32DPIUtils.pixelToPoint(drawable, stringExtentInPixels(string), getZoom());
57295729
}
57305730

57315731
Point stringExtentInPixels (String string) {
@@ -5805,7 +5805,7 @@ public Point textExtent (String string) {
58055805
* </ul>
58065806
*/
58075807
public Point textExtent (String string, int flags) {
5808-
return Win32DPIUtils.pixelToPoint(drawable, textExtentInPixels(string, flags), data.font.zoom);
5808+
return Win32DPIUtils.pixelToPoint(drawable, textExtentInPixels(string, flags), getZoom());
58095809
}
58105810

58115811
Point textExtentInPixels(String string, int flags) {

0 commit comments

Comments
 (0)