Skip to content

Commit c5ec2e3

Browse files
Replacing occurrences of FontData(String) to Deep copy the object
Using the new constructor FontData(fontData) to deep copy the object.
1 parent 8dcdbb8 commit c5ec2e3

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ public Font(Device device, FontData fd) {
103103
super(device);
104104
if (fd == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
105105
this.zoom = DPIUtil.getNativeDeviceZoom();
106-
this.fontData = new FontData(fd.toString());
106+
this.fontData = new FontData(fd);
107107
this.fontHeight = fd.height;
108108
init();
109109
}
@@ -112,7 +112,7 @@ private Font(Device device, FontData fd, int zoom) {
112112
super(device);
113113
if (fd == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
114114
this.zoom = zoom;
115-
this.fontData = new FontData(fd.toString());
115+
this.fontData = new FontData(fd);
116116
this.fontHeight = fd.height;
117117
init();
118118
}
@@ -151,7 +151,7 @@ public Font(Device device, FontData[] fds) {
151151
}
152152
this.zoom = DPIUtil.getNativeDeviceZoom();
153153
FontData fd = fds[0];
154-
this.fontData = new FontData(fd.toString());
154+
this.fontData = new FontData(fd);
155155
this.fontHeight = fd.height;
156156
init();
157157
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ public Font getFont(long fontHandle, int zoom) {
7777
}
7878

7979
private Font registerFont(FontData fontData, Font font) {
80-
FontData clonedFontData = new FontData(fontData.toString());
80+
FontData clonedFontData = new FontData(fontData);
8181
fontsMap.put(clonedFontData, font);
8282
return font;
8383
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ public Font getFont(FontData fontData, int zoom) {
128128
if (customFontsKeyMap.containsKey(fontData)) {
129129
container = customFontsKeyMap.get(fontData);
130130
} else {
131-
FontData clonedFontData = new FontData(fontData.toString());
131+
FontData clonedFontData = new FontData(fontData);
132132
container = new ScaledCustomFontContainer(clonedFontData);
133133
customFontsKeyMap.put(clonedFontData, container);
134134
}

0 commit comments

Comments
 (0)