Skip to content

Commit 756e8d8

Browse files
arunjose696fedejeanne
authored andcommitted
Use font zoom in stringExtent and textExtent
Previously, stringExtent calculated the width of a string in pixels using GC.getZoom(), which could lead to inconsistencies if the provided font had a different zoom level. This change ensures that the pixels-to-points conversion uses the zoom of the specified font.
1 parent 0904886 commit 756e8d8

File tree

1 file changed

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

1 file changed

+2
-2
lines changed

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
@@ -5644,7 +5644,7 @@ void apply() {
56445644
*/
56455645
public Point stringExtent (String string) {
56465646
if (string == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
5647-
return DPIUtil.scaleDown(drawable, stringExtentInPixels(string), getZoom());
5647+
return DPIUtil.scaleDown(drawable, stringExtentInPixels(string), data.font.zoom);
56485648
}
56495649

56505650
Point stringExtentInPixels (String string) {
@@ -5724,7 +5724,7 @@ public Point textExtent (String string) {
57245724
* </ul>
57255725
*/
57265726
public Point textExtent (String string, int flags) {
5727-
return DPIUtil.scaleDown(drawable, textExtentInPixels(string, flags), getZoom());
5727+
return DPIUtil.scaleDown(drawable, textExtentInPixels(string, flags), data.font.zoom);
57285728
}
57295729

57305730
Point textExtentInPixels(String string, int flags) {

0 commit comments

Comments
 (0)