/** * Creates a new FontDescriptor given the associated FontData * * @param data FontData describing the font to create * @return a newly created FontDescriptor */ public static FontDescriptor createFrom(FontData data) { return new ArrayFontDescriptor(new FontData[]{data}); }
@Override public FontData[] getFontData() { // Copy the original array to ensure that callers will not modify it return copy(data); }
/** * Creates a new FontDescriptor given the associated FontData * * @param data FontData describing the font to create * @return a newly created FontDescriptor */ public static FontDescriptor createFrom(FontData data) { return new ArrayFontDescriptor(new FontData[]{data}); }
@Override public FontData[] getFontData() { // Copy the original array to ensure that callers will not modify it return copy(data); }
/** * Creates a new FontDescriptor given the an array of FontData that describes * the font. * * @param data an array of FontData that describes the font (will be passed into * the Font's constructor) * @return a FontDescriptor that describes the given font */ public static FontDescriptor createFrom(FontData[] data) { return new ArrayFontDescriptor(data); }
public FontData[] getFontData() { // Copy the original array to ensure that callers will not modify it return copy(data); }
/** * Creates a FontDescriptor that describes an existing font. The resulting * descriptor depends on the original Font, and disposing the original Font * while the descriptor is still in use may cause SWT to throw a graphic * disposed exception. * * @param font font to create * @return a newly created FontDescriptor that describes the given font */ public static FontDescriptor createFrom(Font font) { return new ArrayFontDescriptor(font); }
/** * Creates a new FontDescriptor given the associated FontData * * @param data FontData describing the font to create * @return a newly created FontDescriptor */ public static FontDescriptor createFrom(FontData data) { return new ArrayFontDescriptor(new FontData[]{data}); }
/** * Creates a new FontDescriptor given the an array of FontData that describes * the font. * * @since 3.1 * * @param data an array of FontData that describes the font (will be passed into * the Font's constructor) * @return a FontDescriptor that describes the given font */ public static FontDescriptor createFrom(FontData[] data) { return new ArrayFontDescriptor(data); }
/** * Creates a new FontDescriptor given the an array of FontData that describes * the font. * * @since 3.1 * * @param data an array of FontData that describes the font (will be passed into * the Font's constructor) * @return a FontDescriptor that describes the given font */ public static FontDescriptor createFrom(FontData[] data) { return new ArrayFontDescriptor(data); }
/** * Creates a FontDescriptor that describes an existing font. The resulting * descriptor depends on the original Font, and disposing the original Font * while the descriptor is still in use may cause SWT to throw a graphic * disposed exception. * * @since 3.1 * * @param font font to create * @return a newly created FontDescriptor that describes the given font */ public static FontDescriptor createFrom(Font font) { return new ArrayFontDescriptor(font); }
/** * Creates a FontDescriptor that describes an existing font. The resulting * descriptor depends on the original Font, and disposing the original Font * while the descriptor is still in use may cause SWT to throw a graphic * disposed exception. * * @since 3.1 * * @param font font to create * @return a newly created FontDescriptor that describes the given font */ public static FontDescriptor createFrom(Font font) { return new ArrayFontDescriptor(font); }
/** * Creates a FontDescriptor that describes an existing font. The resulting * descriptor depends on the Font. Disposing the Font while the descriptor * is still in use may throw a graphic disposed exception. * * @deprecated use {@link FontDescriptor#createFrom(Font)} * * @param font a font to describe * @param originalDevice must be the same Device that was passed into * the font's constructor when it was first created. * @return a newly created FontDescriptor. */ public static FontDescriptor createFrom(Font font, Device originalDevice) { return new ArrayFontDescriptor(font); }
/** * Creates a FontDescriptor that describes an existing font. The resulting * descriptor depends on the Font. Disposing the Font while the descriptor * is still in use may throw a graphic disposed exception. * * @since 3.1 * * @deprecated use {@link FontDescriptor#createFrom(Font)} * * @param font a font to describe * @param originalDevice must be the same Device that was passed into * the font's constructor when it was first created. * @return a newly created FontDescriptor. */ @Deprecated public static FontDescriptor createFrom(Font font, Device originalDevice) { return new ArrayFontDescriptor(font); }
/** * Creates a FontDescriptor that describes an existing font. The resulting * descriptor depends on the Font. Disposing the Font while the descriptor * is still in use may throw a graphic disposed exception. * * @since 3.1 * * @deprecated use {@link FontDescriptor#createFrom(Font)} * * @param font a font to describe * @param originalDevice must be the same Device that was passed into * the font's constructor when it was first created. * @return a newly created FontDescriptor. */ @Deprecated public static FontDescriptor createFrom(Font font, Device originalDevice) { return new ArrayFontDescriptor(font); }
/** * <p>Returns a new FontDescriptor that is equivalent to the reciever, but * has the given height.</p> * * <p>Does not modify the reciever.</p> * * @param height a height, in points * @return a new FontDescriptor with the height, in points * @since 1.1 */ public final FontDescriptor setHeight(int height) { FontData[] data = getFontData(); for (int i = 0; i < data.length; i++) { FontData next = data[i]; next.setHeight(height); } // Optimization: avoid holding onto extra instances by returning the reciever if // if it is exactly the same as the result FontDescriptor result = new ArrayFontDescriptor(data); if (result.equals(this)) { return this; } return result; }
/** * <p>Returns a new FontDescriptor that is equivalent to the receiver, but * has the given height.</p> * * <p>Does not modify the receiver.</p> * * @param height a height, in points * @return a new FontDescriptor with the height, in points * @since 3.3 */ public final FontDescriptor setHeight(int height) { FontData[] data = getFontData(); for (FontData next : data) { next.setHeight(height); } // Optimization: avoid holding onto extra instances by returning the receiver if // if it is exactly the same as the result FontDescriptor result = new ArrayFontDescriptor(data); if (result.equals(this)) { return this; } return result; }
/** * Returns a FontDescriptor that is equivalent to the receiver, but uses * the given style bits. * * <p>Does not modify the receiver.</p> * * @param style a bitwise combination of SWT.NORMAL, SWT.ITALIC and SWT.BOLD * @return a new FontDescriptor with the given style * * @since 3.3 */ public final FontDescriptor setStyle(int style) { FontData[] data = getFontData(); for (FontData next : data) { next.setStyle(style); } // Optimization: avoid holding onto extra instances by returning the receiver if // if it is exactly the same as the result FontDescriptor result = new ArrayFontDescriptor(data); if (result.equals(this)) { return this; } return result; }
/** * <p>Returns a new FontDescriptor that is equivalent to the reciever, but * has the given height.</p> * * <p>Does not modify the reciever.</p> * * @param height a height, in points * @return a new FontDescriptor with the height, in points * @since 3.3 */ public final FontDescriptor setHeight(int height) { FontData[] data = getFontData(); for (int i = 0; i < data.length; i++) { FontData next = data[i]; next.setHeight(height); } // Optimization: avoid holding onto extra instances by returning the reciever if // if it is exactly the same as the result FontDescriptor result = new ArrayFontDescriptor(data); if (result.equals(this)) { return this; } return result; }
/** * Returns a FontDescriptor that is equivalent to the reciever, but uses * the given style bits. * * <p>Does not modify the reciever.</p> * * @param style a bitwise combination of SWT.NORMAL, SWT.ITALIC and SWT.BOLD * @return a new FontDescriptor with the given style * * @since 1.1 */ public final FontDescriptor setStyle(int style) { FontData[] data = getFontData(); for (int i = 0; i < data.length; i++) { FontData next = data[i]; next.setStyle(style); } // Optimization: avoid holding onto extra instances by returning the reciever if // if it is exactly the same as the result FontDescriptor result = new ArrayFontDescriptor(data); if (result.equals(this)) { return this; } return result; }