comparison dwt/graphics/Font.d @ 197:184ab53b7785

Changes and fixes for jface
author Frank Benoit <benoit@tionex.de>
date Thu, 10 Apr 2008 11:19:49 +0200
parents 9a64a7781bab
children 8313535d74fa
comparison
equal deleted inserted replaced
196:1e7701c27c03 197:184ab53b7785
78 * </ul> 78 * </ul>
79 */ 79 */
80 public this(Device device, FontData fd) { 80 public this(Device device, FontData fd) {
81 if (device is null) device = Device.getDevice(); 81 if (device is null) device = Device.getDevice();
82 if (device is null) DWT.error(DWT.ERROR_NULL_ARGUMENT); 82 if (device is null) DWT.error(DWT.ERROR_NULL_ARGUMENT);
83 init(device, fd); 83 init_(device, fd);
84 if (device.tracking) device.new_Object(this); 84 if (device.tracking) device.new_Object(this);
85 } 85 }
86 86
87 /** 87 /**
88 * Constructs a new font given a device and an array 88 * Constructs a new font given a device and an array
113 if (fds is null) DWT.error(DWT.ERROR_NULL_ARGUMENT); 113 if (fds is null) DWT.error(DWT.ERROR_NULL_ARGUMENT);
114 if (fds.length is 0) DWT.error(DWT.ERROR_INVALID_ARGUMENT); 114 if (fds.length is 0) DWT.error(DWT.ERROR_INVALID_ARGUMENT);
115 for (int i=0; i<fds.length; i++) { 115 for (int i=0; i<fds.length; i++) {
116 if (fds[i] is null) DWT.error(DWT.ERROR_INVALID_ARGUMENT); 116 if (fds[i] is null) DWT.error(DWT.ERROR_INVALID_ARGUMENT);
117 } 117 }
118 init(device, fds[0]); 118 init_(device, fds[0]);
119 if (device.tracking) device.new_Object(this); 119 if (device.tracking) device.new_Object(this);
120 } 120 }
121 121
122 /** 122 /**
123 * Constructs a new font given a device, a font name, 123 * Constructs a new font given a device, a font name,
143 */ 143 */
144 public this(Device device, char[] name, int height, int style) { 144 public this(Device device, char[] name, int height, int style) {
145 if (device is null) device = Device.getDevice(); 145 if (device is null) device = Device.getDevice();
146 if (device is null) DWT.error(DWT.ERROR_NULL_ARGUMENT); 146 if (device is null) DWT.error(DWT.ERROR_NULL_ARGUMENT);
147 if (name is null) DWT.error(DWT.ERROR_NULL_ARGUMENT); 147 if (name is null) DWT.error(DWT.ERROR_NULL_ARGUMENT);
148 init(device, new FontData (name, height, style)); 148 init_(device, new FontData (name, height, style));
149 if (device.tracking) device.new_Object(this); 149 if (device.tracking) device.new_Object(this);
150 } 150 }
151 151
152 /*public*/ this(Device device, char[] name, float height, int style) { 152 /*public*/ this(Device device, char[] name, float height, int style) {
153 if (device is null) device = Device.getDevice(); 153 if (device is null) device = Device.getDevice();
154 if (device is null) DWT.error(DWT.ERROR_NULL_ARGUMENT); 154 if (device is null) DWT.error(DWT.ERROR_NULL_ARGUMENT);
155 if (name is null) DWT.error(DWT.ERROR_NULL_ARGUMENT); 155 if (name is null) DWT.error(DWT.ERROR_NULL_ARGUMENT);
156 init(device, new FontData (name, height, style)); 156 init_(device, new FontData (name, height, style));
157 if (device.tracking) device.new_Object(this); 157 if (device.tracking) device.new_Object(this);
158 } 158 }
159 159
160 /** 160 /**
161 * Disposes of the operating system resources associated with 161 * Disposes of the operating system resources associated with
220 */ 220 */
221 override public hash_t toHash () { 221 override public hash_t toHash () {
222 return cast(hash_t)handle; 222 return cast(hash_t)handle;
223 } 223 }
224 224
225 void init (Device device, FontData fd) { 225 void init_ (Device device, FontData fd) {
226 if (fd is null) DWT.error(DWT.ERROR_NULL_ARGUMENT); 226 if (fd is null) DWT.error(DWT.ERROR_NULL_ARGUMENT);
227 this.device = device; 227 this.device = device;
228 LOGFONT* logFont = &fd.data; 228 LOGFONT* logFont = &fd.data;
229 int lfHeight = logFont.lfHeight; 229 int lfHeight = logFont.lfHeight;
230 logFont.lfHeight = device.computePixels(fd.height); 230 logFont.lfHeight = device.computePixels(fd.height);