diff dwt/graphics/Font.d @ 23:f5482da87ed8

Image, ImageData
author Frank Benoit <benoit@tionex.de>
date Sun, 27 Jan 2008 17:43:55 +0100
parents 1bea9f0c6f63
children 9a64a7781bab
line wrap: on
line diff
--- a/dwt/graphics/Font.d	Sat Jan 26 19:05:32 2008 +0100
+++ b/dwt/graphics/Font.d	Sun Jan 27 17:43:55 2008 +0100
@@ -1,4 +1,4 @@
-/*******************************************************************************
+/*******************************************************************************
  * Copyright (c) 2000, 2006 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
@@ -7,6 +7,8 @@
  *
  * Contributors:
  *     IBM Corporation - initial API and implementation
+ * Port to the D programming language:
+ *     Frank Benoit <benoit@tionex.de>
  *******************************************************************************/
 module dwt.graphics.Font;
 
@@ -18,10 +20,10 @@
 
 import dwt.graphics.Resource;
 import dwt.graphics.FontData;
-import dwt.graphics.Device; 
+import dwt.graphics.Device;
 
 import tango.text.convert.Format;
-//import tango.stdc.stringz; 
+//import tango.stdc.stringz;
 
 /**
  * Instances of this class manage operating system resources that
@@ -29,7 +31,7 @@
  * by providing a device and either name, size and style information
  * or a <code>FontData</code> object which encapsulates this data.
  * <p>
- * Application code must explicitly invoke the <code>Font.dispose()</code> 
+ * Application code must explicitly invoke the <code>Font.dispose()</code>
  * method to release the operating system resources managed by each instance
  * when those instances are no longer required.
  * </p>
@@ -38,7 +40,7 @@
  */
 
 public final class Font : Resource {
-    
+
     /**
      * the handle to the OS font resource
      * (Warning: This field is platform dependent)
@@ -50,23 +52,23 @@
      * </p>
      */
     public HFONT handle;
-    
+
 /**
  * Prevents uninitialized instances from being created outside the package.
  */
 this() {
 }
 
-/**  
+/**
  * Constructs a new font given a device and font data
  * which describes the desired font's appearance.
  * <p>
- * You must dispose the font when it is no longer required. 
+ * You must dispose the font when it is no longer required.
  * </p>
  *
  * @param device the device to create the font on
  * @param fd the FontData that describes the desired font (must not be null)
- * 
+ *
  * @exception IllegalArgumentException <ul>
  *    <li>ERROR_NULL_ARGUMENT - if device is null and there is no current device</li>
  *    <li>ERROR_NULL_ARGUMENT - if the fd argument is null</li>
@@ -79,20 +81,20 @@
     if (device is null) device = Device.getDevice();
     if (device is null) DWT.error(DWT.ERROR_NULL_ARGUMENT);
     init(device, fd);
-    if (device.tracking) device.new_Object(this);   
+    if (device.tracking) device.new_Object(this);
 }
 
-/**  
+/**
  * Constructs a new font given a device and an array
  * of font data which describes the desired font's
  * appearance.
  * <p>
- * You must dispose the font when it is no longer required. 
+ * You must dispose the font when it is no longer required.
  * </p>
  *
  * @param device the device to create the font on
  * @param fds the array of FontData that describes the desired font (must not be null)
- * 
+ *
  * @exception IllegalArgumentException <ul>
  *    <li>ERROR_NULL_ARGUMENT - if device is null and there is no current device</li>
  *    <li>ERROR_NULL_ARGUMENT - if the fds argument is null</li>
@@ -102,7 +104,7 @@
  * @exception DWTError <ul>
  *    <li>ERROR_NO_HANDLES - if a font could not be created from the given font data</li>
  * </ul>
- * 
+ *
  * @since 2.1
  */
 public this(Device device, FontData[] fds) {
@@ -114,22 +116,22 @@
         if (fds[i] is null) DWT.error(DWT.ERROR_INVALID_ARGUMENT);
     }
     init(device, fds[0]);
-    if (device.tracking) device.new_Object(this);   
+    if (device.tracking) device.new_Object(this);
 }
 
-/**  
+/**
  * Constructs a new font given a device, a font name,
  * the height of the desired font in points, and a font
  * style.
  * <p>
- * You must dispose the font when it is no longer required. 
+ * You must dispose the font when it is no longer required.
  * </p>
  *
  * @param device the device to create the font on
  * @param name the name of the font (must not be null)
  * @param height the font height in points
  * @param style a bit or combination of NORMAL, BOLD, ITALIC
- * 
+ *
  * @exception IllegalArgumentException <ul>
  *    <li>ERROR_NULL_ARGUMENT - if device is null and there is no current device</li>
  *    <li>ERROR_NULL_ARGUMENT - if the name argument is null</li>
@@ -144,7 +146,7 @@
     if (device is null) DWT.error(DWT.ERROR_NULL_ARGUMENT);
     if (name is null) DWT.error(DWT.ERROR_NULL_ARGUMENT);
     init(device, new FontData (name, height, style));
-    if (device.tracking) device.new_Object(this);   
+    if (device.tracking) device.new_Object(this);
 }
 
 /*public*/ this(Device device, char[] name, float height, int style) {
@@ -152,7 +154,7 @@
     if (device is null) DWT.error(DWT.ERROR_NULL_ARGUMENT);
     if (name is null) DWT.error(DWT.ERROR_NULL_ARGUMENT);
     init(device, new FontData (name, height, style));
-    if (device.tracking) device.new_Object(this);   
+    if (device.tracking) device.new_Object(this);
 }
 
 /**
@@ -189,8 +191,8 @@
 
 /**
  * Returns an array of <code>FontData</code>s representing the receiver.
- * On Windows, only one FontData will be returned per font. On X however, 
- * a <code>Font</code> object <em>may</em> be composed of multiple X 
+ * On Windows, only one FontData will be returned per font. On X however,
+ * a <code>Font</code> object <em>may</em> be composed of multiple X
  * fonts. To support this case, we return an array of font data objects.
  *
  * @return an array of font data objects describing the receiver
@@ -207,8 +209,8 @@
 }
 
 /**
- * Returns an integer hash code for the receiver. Any two 
- * objects that return <code>true</code> when passed to 
+ * Returns an integer hash code for the receiver. Any two
+ * objects that return <code>true</code> when passed to
  * <code>equals</code> must return the same value for this
  * method.
  *
@@ -256,7 +258,7 @@
     return Format( "Font {{{}}", handle );
 }
 
-/**  
+/**
  * Invokes platform specific functionality to allocate a new font.
  * <p>
  * <b>IMPORTANT:</b> This method is <em>not</em> part of the public