Skip to content

Commit 5a42d9f

Browse files
committed
[Win32] Return unrounded value in FontMetrics.getAverageCharacterWidth
The value for getAverageCharacterWidth was rounded, even though its method signature returns a float. The unrounded value provides a better estimation of the average character width for non-integer zoom factors. Fixes: #2461
1 parent c6a29a9 commit 5a42d9f

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/FontMetrics.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ public int getAscent() {
108108
* @since 3.107
109109
*/
110110
public double getAverageCharacterWidth() {
111-
return getAverageCharWidth();
111+
return DPIUtil.pixelToPoint((float)handle.tmAveCharWidth, getZoom());
112112
}
113113

114114
/**

0 commit comments

Comments
 (0)