Skip to content

Commit d32fe1c

Browse files
Addition of Deep Copy Methods for FontData in Cocoa and GTK
1 parent 8358a0c commit d32fe1c

File tree

2 files changed

+39
-0
lines changed

2 files changed

+39
-0
lines changed

bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/graphics/FontData.java

+20
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,26 @@ public FontData(String string) {
186186
}
187187
}
188188

189+
/**
190+
* Constructs a new FontData copy
191+
*
192+
* @param fontData the FondData object for which copy is needed to be made
193+
*
194+
* @exception IllegalArgumentException
195+
* <ul>
196+
* <li>ERROR_NULL_ARGUMENT - if the argument is null</li>
197+
* </ul>
198+
* @since 3.130
199+
*/
200+
public FontData(FontData fontData) {
201+
if (fontData == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
202+
203+
setName(fontData.name);
204+
setHeight(fontData.height);
205+
setStyle(fontData.style);
206+
this.nsName = fontData.nsName;
207+
}
208+
189209
/**
190210
* Constructs a new font data given a font name,
191211
* the height of the desired font in points,

bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/FontData.java

+19
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,25 @@ public FontData(String string) {
184184
}
185185
}
186186

187+
/**
188+
* Constructs a new FontData copy
189+
*
190+
* @param fontData the FondData object for which copy is needed to be made
191+
*
192+
* @exception IllegalArgumentException
193+
* <ul>
194+
* <li>ERROR_NULL_ARGUMENT - if the argument is null</li>
195+
* </ul>
196+
* @since 3.130
197+
*/
198+
public FontData(FontData fontData) {
199+
if (fontData == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
200+
201+
setName(fontData.name);
202+
setHeight(fontData.height);
203+
setStyle(fontData.style);
204+
}
205+
187206
/**
188207
* Constructs a new font data given a font name,
189208
* the height of the desired font in points,

0 commit comments

Comments
 (0)