Mercurial > projects > dwt-mac
comparison dwt/internal/cocoa/NSFont.d @ 45:d8635bb48c7c
Merge with SWT 3.5
author | Jacob Carlborg <doob@me.com> |
---|---|
date | Mon, 01 Dec 2008 17:07:00 +0100 |
parents | f565d3a95c0a |
children | 62202ce0039f |
comparison
equal
deleted
inserted
replaced
44:ca5e494f2bbf | 45:d8635bb48c7c |
---|---|
1 /******************************************************************************* | 1 /******************************************************************************* |
2 * Copyright (c) 2007 IBM Corporation and others. | 2 * Copyright (c) 2000, 2008 IBM Corporation and others. |
3 * All rights reserved. This program and the accompanying materials | 3 * All rights reserved. This program and the accompanying materials |
4 * are made available under the terms of the Eclipse Public License v1.0 | 4 * are made available under the terms of the Eclipse Public License v1.0 |
5 * which accompanies this distribution, and is available at | 5 * which accompanies this distribution, and is available at |
6 * http://www.eclipse.org/legal/epl-v10.html | 6 * http://www.eclipse.org/legal/epl-v10.html |
7 * | 7 * |
8 * Contributors: | 8 * Contributors: |
9 * IBM Corporation - initial API and implementation | 9 * IBM Corporation - initial API and implementation |
10 * | 10 * |
11 * Port to the D programming language: | 11 * Port to the D programming language: |
12 * Jacob Carlborg <jacob.carlborg@gmail.com> | 12 * Jacob Carlborg <doob@me.com> |
13 *******************************************************************************/ | 13 *******************************************************************************/ |
14 module dwt.internal.cocoa.NSFont; | 14 module dwt.internal.cocoa.NSFont; |
15 | 15 |
16 import dwt.internal.cocoa.CGFloat; | 16 import dwt.dwthelper.utils; |
17 import dwt.internal.cocoa.id; | 17 import dwt.internal.c.Carbon; |
18 import dwt.internal.cocoa.NSAffineTransform; | 18 import cocoa = dwt.internal.cocoa.id; |
19 import dwt.internal.cocoa.NSArray; | 19 import dwt.internal.cocoa.NSCell; |
20 import dwt.internal.cocoa.NSCharacterSet; | |
21 import dwt.internal.cocoa.NSCell : NSControlSize; | |
22 import dwt.internal.cocoa.NSDictionary; | |
23 import dwt.internal.cocoa.NSFontDescriptor; | |
24 import dwt.internal.cocoa.NSGraphicsContext; | |
25 import dwt.internal.cocoa.NSInteger; | |
26 import dwt.internal.cocoa.NSObject; | 20 import dwt.internal.cocoa.NSObject; |
27 import dwt.internal.cocoa.NSPoint; | |
28 import dwt.internal.cocoa.NSRect; | |
29 import dwt.internal.cocoa.NSSize; | |
30 import dwt.internal.cocoa.NSString; | 21 import dwt.internal.cocoa.NSString; |
31 import dwt.internal.cocoa.OS; | 22 import dwt.internal.cocoa.OS; |
32 //import dwt.internal.objc.foundation.NSGeometry; | |
33 import objc = dwt.internal.objc.runtime; | 23 import objc = dwt.internal.objc.runtime; |
34 | 24 |
35 alias uint NSGlyph; | 25 alias uint NSGlyph; |
36 | 26 |
37 enum NSMultibyteGlyphPacking | 27 public class NSFont : NSObject { |
38 { | 28 |
39 NSNativeShortGlyphPacking = 5 | 29 public this() { |
30 super(); | |
40 } | 31 } |
41 | 32 |
42 enum NSGlyphRelation | 33 public this(objc.id id) { |
43 { | 34 super(id); |
44 NSGlyphBelow = 1, | |
45 NSGlyphAbove = 2 | |
46 } | 35 } |
47 | 36 |
48 enum NSFontRenderingMode | 37 public this(cocoa.id id) { |
49 { | 38 super(id); |
50 NSFontDefaultRenderingMode = 0, | |
51 NSFontAntialiasedRenderingMode = 1, | |
52 NSFontIntegerAdvancementsRenderingMode = 2, | |
53 NSFontAntialiasedIntegerAdvancementsRenderingMode = 3 | |
54 } | 39 } |
55 | 40 |
56 public class NSFont : NSObject | 41 public CGFloat ascender() { |
57 { | 42 return cast(CGFloat) OS.objc_msgSend_fpret(this.id, OS.sel_ascender); |
43 } | |
58 | 44 |
59 public this () | 45 public CGFloat descender() { |
60 { | 46 return cast(CGFloat) OS.objc_msgSend_fpret(this.id, OS.sel_descender); |
61 super(); | 47 } |
62 } | |
63 | 48 |
64 public this (objc.id id) | 49 public NSString familyName() { |
65 { | 50 objc.id result = OS.objc_msgSend(this.id, OS.sel_familyName); |
66 super(id); | 51 return result !is null ? new NSString(result) : null; |
67 } | 52 } |
68 | 53 |
69 public NSSize advancementForGlyph (NSGlyph ag) | 54 public NSString fontName() { |
70 { | 55 objc.id result = OS.objc_msgSend(this.id, OS.sel_fontName); |
71 NSSize result; | 56 return result !is null ? new NSString(result) : null; |
72 OS.objc_msgSend_stret(&result, this.id_, OS.sel_advancementForGlyph_1, ag); | 57 } |
73 return result; | |
74 } | |
75 | 58 |
76 public NSDictionary afmDictionary () | 59 public static NSFont fontWithName(NSString fontName, float /*double*/ fontSize) { |
77 { | 60 objc.id result = OS.objc_msgSend(OS.class_NSFont, OS.sel_fontWithName_size_, fontName !is null ? fontName.id : null, fontSize); |
78 objc.id result = OS.objc_msgSend(this.id_, OS.sel_afmDictionary); | 61 return result !is null ? new NSFont(result) : null; |
79 return result !is null ? new NSDictionary(result) : null; | 62 } |
80 } | |
81 | 63 |
82 public CGFloat ascender () | 64 public CGFloat leading() { |
83 { | 65 return cast(CGFloat) OS.objc_msgSend_fpret(this.id, OS.sel_leading); |
84 return cast(CGFloat) OS.objc_msgSend_fpret(this.id_, OS.sel_ascender); | 66 } |
85 } | |
86 | 67 |
87 public static NSFont boldSystemFontOfSize (CGFloat fontSize) | 68 public CGFloat pointSize() { |
88 { | 69 return cast(CGFloat) OS.objc_msgSend_fpret(this.id, OS.sel_pointSize); |
89 objc.id result = OS.objc_msgSend(OS.class_NSFont, OS.sel_boldSystemFontOfSize_1, fontSize); | 70 } |
90 return result !is null ? new NSFont(result) : null; | |
91 } | |
92 | 71 |
93 public NSRect boundingRectForFont () | 72 public static CGFloat smallSystemFontSize() { |
94 { | 73 return cast(CGFloat) OS.objc_msgSend_fpret(OS.class_NSFont, OS.sel_smallSystemFontSize); |
95 NSRect result; | 74 } |
96 OS.objc_msgSend_stret(&result, this.id_, OS.sel_boundingRectForFont); | |
97 return result; | |
98 } | |
99 | 75 |
100 public NSRect boundingRectForGlyph (NSGlyph aGlyph) | 76 public static NSFont systemFontOfSize(CGFloat fontSize) { |
101 { | 77 objc.id result = OS.objc_msgSend(OS.class_NSFont, OS.sel_systemFontOfSize_, fontSize); |
102 NSRect result; | 78 return result !is null ? new NSFont(result) : null; |
103 OS.objc_msgSend_stret(&result, this.id_, OS.sel_boundingRectForGlyph_1, aGlyph); | 79 } |
104 return result; | |
105 } | |
106 | 80 |
107 public CGFloat capHeight () | 81 public static CGFloat systemFontSize() { |
108 { | 82 return cast(CGFloat) OS.objc_msgSend_fpret(OS.class_NSFont, OS.sel_systemFontSize); |
109 return cast(CGFloat) OS.objc_msgSend_fpret(this.id_, OS.sel_capHeight); | 83 } |
110 } | |
111 | 84 |
112 public static NSFont controlContentFontOfSize (CGFloat fontSize) | 85 public static CGFloat systemFontSizeForControlSize(NSControlSize controlSize) { |
113 { | 86 return cast(CGFloat) OS.objc_msgSend_fpret(OS.class_NSFont, OS.sel_systemFontSizeForControlSize_, controlSize); |
114 objc.id result = OS.objc_msgSend(OS.class_NSFont, OS.sel_controlContentFontOfSize_1, fontSize); | 87 } |
115 return result !is null ? new NSFont(result) : null; | |
116 } | |
117 | |
118 public NSCharacterSet coveredCharacterSet () | |
119 { | |
120 objc.id result = OS.objc_msgSend(this.id_, OS.sel_coveredCharacterSet); | |
121 return result !is null ? new NSCharacterSet(result) : null; | |
122 } | |
123 | |
124 public CGFloat defaultLineHeightForFont () | |
125 { | |
126 return cast(CGFloat) OS.objc_msgSend_fpret(this.id_, OS.sel_defaultLineHeightForFont); | |
127 } | |
128 | |
129 public CGFloat descender () | |
130 { | |
131 return cast(CGFloat) OS.objc_msgSend_fpret(this.id_, OS.sel_descender); | |
132 } | |
133 | |
134 public NSString displayName () | |
135 { | |
136 objc.id result = OS.objc_msgSend(this.id_, OS.sel_displayName); | |
137 return result !is null ? new NSString(result) : null; | |
138 } | |
139 | |
140 public NSString encodingScheme () | |
141 { | |
142 objc.id result = OS.objc_msgSend(this.id_, OS.sel_encodingScheme); | |
143 return result !is null ? new NSString(result) : null; | |
144 } | |
145 | |
146 public NSString familyName () | |
147 { | |
148 objc.id result = OS.objc_msgSend(this.id_, OS.sel_familyName); | |
149 return result !is null ? new NSString(result) : null; | |
150 } | |
151 | |
152 public NSFontDescriptor fontDescriptor () | |
153 { | |
154 objc.id result = OS.objc_msgSend(this.id_, OS.sel_fontDescriptor); | |
155 return result !is null ? new NSFontDescriptor(result) : null; | |
156 } | |
157 | |
158 public NSString fontName () | |
159 { | |
160 objc.id result = OS.objc_msgSend(this.id_, OS.sel_fontName); | |
161 return result !is null ? new NSString(result) : null; | |
162 } | |
163 | |
164 public static NSFont static_fontWithDescriptor_size_ (NSFontDescriptor fontDescriptor, CGFloat fontSize) | |
165 { | |
166 objc.id result = OS.objc_msgSend(OS.class_NSFont, OS.sel_fontWithDescriptor_1size_1, fontDescriptor !is null ? fontDescriptor.id_ : null, | |
167 fontSize); | |
168 return result !is null ? new NSFont(result) : null; | |
169 } | |
170 | |
171 public static NSFont static_fontWithDescriptor_textTransform_ (NSFontDescriptor fontDescriptor, NSAffineTransform textTransform) | |
172 { | |
173 objc.id result = OS.objc_msgSend(OS.class_NSFont, OS.sel_fontWithDescriptor_1textTransform_1, | |
174 fontDescriptor !is null ? fontDescriptor.id_ : null, textTransform !is null ? textTransform.id_ : null); | |
175 return result !is null ? new NSFont(result) : null; | |
176 } | |
177 | |
178 public static NSFont static_fontWithName_matrix_ (NSString fontName, CGFloat fontMatrix) | |
179 { | |
180 objc.id result = OS.objc_msgSend(OS.class_NSFont, OS.sel_fontWithName_1matrix_1, fontName !is null ? fontName.id_ : null, fontMatrix); | |
181 return result !is null ? new NSFont(result) : null; | |
182 } | |
183 | |
184 public static NSFont static_fontWithName_size_ (NSString fontName, CGFloat fontSize) | |
185 { | |
186 objc.id result = OS.objc_msgSend(OS.class_NSFont, OS.sel_fontWithName_1size_1, fontName !is null ? fontName.id_ : null, fontSize); | |
187 return result !is null ? new NSFont(result) : null; | |
188 } | |
189 | |
190 public void getAdvancements_forGlyphs_count_ (NSSizeArray advancements, /*const*/NSGlyph* glyphs, NSUInteger glyphCount) | |
191 { | |
192 OS.objc_msgSend(this.id_, OS.sel_getAdvancements_1forGlyphs_1count_1, advancements, glyphs, glyphCount); | |
193 } | |
194 | |
195 public void getAdvancements_forPackedGlyphs_length_ (NSSizeArray advancements, /*const*/void* packedGlyphs, NSUInteger length) | |
196 { | |
197 OS.objc_msgSend(this.id_, OS.sel_getAdvancements_1forPackedGlyphs_1length_1, advancements, packedGlyphs, length); | |
198 } | |
199 | |
200 public void getBoundingRects (NSRectArray bounds, /*const*/NSGlyph* glyphs, NSUInteger glyphCount) | |
201 { | |
202 OS.objc_msgSend(this.id_, OS.sel_getBoundingRects_1forGlyphs_1count_1, bounds, glyphs, glyphCount); | |
203 } | |
204 | |
205 public bool glyphIsEncoded (NSGlyph aGlyph) | |
206 { | |
207 return OS.objc_msgSend(this.id_, OS.sel_glyphIsEncoded_1, aGlyph) !is null; | |
208 } | |
209 | |
210 public NSMultibyteGlyphPacking glyphPacking () | |
211 { | |
212 return cast(NSMultibyteGlyphPacking) OS.objc_msgSend(this.id_, OS.sel_glyphPacking); | |
213 } | |
214 | |
215 public NSGlyph glyphWithName (NSString aName) | |
216 { | |
217 return cast(NSGlyph) OS.objc_msgSend(this.id_, OS.sel_glyphWithName_1, aName !is null ? aName.id_ : null); | |
218 } | |
219 | |
220 public bool isBaseFont () | |
221 { | |
222 return OS.objc_msgSend(this.id_, OS.sel_isBaseFont) !is null; | |
223 } | |
224 | |
225 public bool isFixedPitch () | |
226 { | |
227 return OS.objc_msgSend(this.id_, OS.sel_isFixedPitch) !is null; | |
228 } | |
229 | |
230 public CGFloat italicAngle () | |
231 { | |
232 return cast(CGFloat) OS.objc_msgSend_fpret(this.id_, OS.sel_italicAngle); | |
233 } | |
234 | |
235 public static NSFont labelFontOfSize (CGFloat fontSize) | |
236 { | |
237 objc.id result = OS.objc_msgSend(OS.class_NSFont, OS.sel_labelFontOfSize_1, fontSize); | |
238 return result !is null ? new NSFont(result) : null; | |
239 } | |
240 | |
241 public static CGFloat labelFontSize () | |
242 { | |
243 return cast(CGFloat) OS.objc_msgSend_fpret(OS.class_NSFont, OS.sel_labelFontSize); | |
244 } | |
245 | |
246 public CGFloat leading () | |
247 { | |
248 return cast(CGFloat) OS.objc_msgSend_fpret(this.id_, OS.sel_leading); | |
249 } | |
250 | |
251 public /*const*/CGFloat* matrix () | |
252 { | |
253 return cast(/*const*/CGFloat*) OS.objc_msgSend(this.id_, OS.sel_matrix); | |
254 } | |
255 | |
256 public NSSize maximumAdvancement () | |
257 { | |
258 NSSize result; | |
259 OS.objc_msgSend_stret(&result, this.id_, OS.sel_maximumAdvancement); | |
260 return result; | |
261 } | |
262 | |
263 public static NSFont menuBarFontOfSize (CGFloat fontSize) | |
264 { | |
265 objc.id result = OS.objc_msgSend(OS.class_NSFont, OS.sel_menuBarFontOfSize_1, fontSize); | |
266 return result !is null ? new NSFont(result) : null; | |
267 } | |
268 | |
269 public static NSFont menuFontOfSize (CGFloat fontSize) | |
270 { | |
271 objc.id result = OS.objc_msgSend(OS.class_NSFont, OS.sel_menuFontOfSize_1, fontSize); | |
272 return result !is null ? new NSFont(result) : null; | |
273 } | |
274 | |
275 public static NSFont messageFontOfSize (CGFloat fontSize) | |
276 { | |
277 objc.id result = OS.objc_msgSend(OS.class_NSFont, OS.sel_messageFontOfSize_1, fontSize); | |
278 return result !is null ? new NSFont(result) : null; | |
279 } | |
280 | |
281 public NSStringEncoding mostCompatibleStringEncoding () | |
282 { | |
283 return cast(NSStringEncoding) OS.objc_msgSend(this.id_, OS.sel_mostCompatibleStringEncoding); | |
284 } | |
285 | |
286 public NSUInteger numberOfGlyphs () | |
287 { | |
288 return cast(NSUInteger) OS.objc_msgSend(this.id_, OS.sel_numberOfGlyphs); | |
289 } | |
290 | |
291 public static NSFont paletteFontOfSize (CGFloat fontSize) | |
292 { | |
293 objc.id result = OS.objc_msgSend(OS.class_NSFont, OS.sel_paletteFontOfSize_1, fontSize); | |
294 return result !is null ? new NSFont(result) : null; | |
295 } | |
296 | |
297 public CGFloat pointSize () | |
298 { | |
299 return cast(CGFloat) OS.objc_msgSend_fpret(this.id_, OS.sel_pointSize); | |
300 } | |
301 | |
302 public NSPoint positionOfGlyph_forCharacter_struckOverRect_ (NSGlyph aGlyph, short aChar, NSRect aRect) | |
303 { | |
304 NSPoint result; | |
305 OS.objc_msgSend_stret(&result, this.id_, OS.sel_positionOfGlyph_1forCharacter_1struckOverRect_1, aGlyph, aChar, aRect); | |
306 return result; | |
307 } | |
308 | |
309 public NSPoint positionOfGlyph_precededByGlyph_isNominal_ (NSGlyph curGlyph, NSGlyph prevGlyph, bool* nominal) | |
310 { | |
311 NSPoint result; | |
312 OS.objc_msgSend_stret(&result, this.id_, OS.sel_positionOfGlyph_1precededByGlyph_1isNominal_1, curGlyph, prevGlyph, nominal); | |
313 return result; | |
314 } | |
315 | |
316 public NSPoint positionOfGlyph_struckOverGlyph_metricsExist_ (NSGlyph curGlyph, NSGlyph prevGlyph, bool* exist) | |
317 { | |
318 NSPoint result; | |
319 OS.objc_msgSend_stret(&result, this.id_, OS.sel_positionOfGlyph_1struckOverGlyph_1metricsExist_1, curGlyph, prevGlyph, exist); | |
320 return result; | |
321 } | |
322 | |
323 public NSPoint positionOfGlyph_struckOverRect_metricsExist_ (NSGlyph aGlyph, NSRect aRect, bool* exist) | |
324 { | |
325 NSPoint result; | |
326 OS.objc_msgSend_stret(&result, this.id_, OS.sel_positionOfGlyph_1struckOverRect_1metricsExist_1, aGlyph, aRect, exist); | |
327 return result; | |
328 } | |
329 | |
330 public NSPoint positionOfGlyph_withRelation_toBaseGlyph_totalAdvancement_metricsExist_ (NSGlyph thisGlyph, NSGlyphRelation rel, | |
331 NSGlyph baseGlyph, NSSizePointer adv, bool* exist) | |
332 { | |
333 NSPoint result; | |
334 OS.objc_msgSend_stret(&result, this.id_, OS.sel_positionOfGlyph_1withRelation_1toBaseGlyph_1totalAdvancement_1metricsExist_1, thisGlyph, rel, | |
335 baseGlyph, adv, exist); | |
336 return result; | |
337 } | |
338 | |
339 public NSInteger positionsForCompositeSequence (NSGlyph* someGlyphs, NSInteger numGlyphs, NSPointArray points) | |
340 { | |
341 return cast(NSInteger) OS.objc_msgSend(this.id_, OS.sel_positionsForCompositeSequence_1numberOfGlyphs_1pointArray_1, someGlyphs, numGlyphs, points); | |
342 } | |
343 | |
344 public static NSArray preferredFontNames () | |
345 { | |
346 objc.id result = OS.objc_msgSend(OS.class_NSFont, OS.sel_preferredFontNames); | |
347 return result !is null ? new NSArray(result) : null; | |
348 } | |
349 | |
350 public NSFont printerFont () | |
351 { | |
352 objc.id result = OS.objc_msgSend(this.id_, OS.sel_printerFont); | |
353 return result is this.id_ ? this : (result !is null ? new NSFont(result) : null); | |
354 } | |
355 | |
356 public NSFontRenderingMode renderingMode () | |
357 { | |
358 return cast(NSFontRenderingMode) OS.objc_msgSend(this.id_, OS.sel_renderingMode); | |
359 } | |
360 | |
361 public NSFont screenFont () | |
362 { | |
363 objc.id result = OS.objc_msgSend(this.id_, OS.sel_screenFont); | |
364 return result is this.id_ ? this : (result !is null ? new NSFont(result) : null); | |
365 } | |
366 | |
367 public NSFont screenFontWithRenderingMode (NSFontRenderingMode renderingMode) | |
368 { | |
369 objc.id result = OS.objc_msgSend(this.id_, OS.sel_screenFontWithRenderingMode_1, renderingMode); | |
370 return result is this.id_ ? this : (result !is null ? new NSFont(result) : null); | |
371 } | |
372 | |
373 public void set () | |
374 { | |
375 OS.objc_msgSend(this.id_, OS.sel_set); | |
376 } | |
377 | |
378 public void setInContext (NSGraphicsContext graphicsContext) | |
379 { | |
380 OS.objc_msgSend(this.id_, OS.sel_setInContext_1, graphicsContext !is null ? graphicsContext.id_ : null); | |
381 } | |
382 | |
383 public static void setPreferredFontNames (NSArray fontNameArray) | |
384 { | |
385 OS.objc_msgSend(OS.class_NSFont, OS.sel_setPreferredFontNames_1, fontNameArray !is null ? fontNameArray.id_ : null); | |
386 } | |
387 | |
388 public static void setUserFixedPitchFont (NSFont aFont) | |
389 { | |
390 OS.objc_msgSend(OS.class_NSFont, OS.sel_setUserFixedPitchFont_1, aFont !is null ? aFont.id_ : null); | |
391 } | |
392 | |
393 public static void setUserFont (NSFont aFont) | |
394 { | |
395 OS.objc_msgSend(OS.class_NSFont, OS.sel_setUserFont_1, aFont !is null ? aFont.id_ : null); | |
396 } | |
397 | |
398 public static CGFloat smallSystemFontSize () | |
399 { | |
400 return cast(CGFloat) OS.objc_msgSend_fpret(OS.class_NSFont, OS.sel_smallSystemFontSize); | |
401 } | |
402 | |
403 public static NSFont systemFontOfSize (CGFloat fontSize) | |
404 { | |
405 objc.id result = OS.objc_msgSend(OS.class_NSFont, OS.sel_systemFontOfSize_1, fontSize); | |
406 return result !is null ? new NSFont(result) : null; | |
407 } | |
408 | |
409 public static CGFloat systemFontSize () | |
410 { | |
411 return cast(CGFloat) OS.objc_msgSend_fpret(OS.class_NSFont, OS.sel_systemFontSize); | |
412 } | |
413 | |
414 public static CGFloat systemFontSizeForControlSize (NSControlSize controlSize) | |
415 { | |
416 return cast(CGFloat) OS.objc_msgSend_fpret(OS.class_NSFont, OS.sel_systemFontSizeForControlSize_1, controlSize); | |
417 } | |
418 | |
419 public NSAffineTransform textTransform () | |
420 { | |
421 objc.id result = OS.objc_msgSend(this.id_, OS.sel_textTransform); | |
422 return result !is null ? new NSAffineTransform(result) : null; | |
423 } | |
424 | |
425 public static NSFont titleBarFontOfSize (CGFloat fontSize) | |
426 { | |
427 objc.id result = OS.objc_msgSend(OS.class_NSFont, OS.sel_titleBarFontOfSize_1, fontSize); | |
428 return result !is null ? new NSFont(result) : null; | |
429 } | |
430 | |
431 public static NSFont toolTipsFontOfSize (CGFloat fontSize) | |
432 { | |
433 objc.id result = OS.objc_msgSend(OS.class_NSFont, OS.sel_toolTipsFontOfSize_1, fontSize); | |
434 return result !is null ? new NSFont(result) : null; | |
435 } | |
436 | |
437 public CGFloat underlinePosition () | |
438 { | |
439 return cast(CGFloat) OS.objc_msgSend_fpret(this.id_, OS.sel_underlinePosition); | |
440 } | |
441 | |
442 public CGFloat underlineThickness () | |
443 { | |
444 return cast(CGFloat) OS.objc_msgSend_fpret(this.id_, OS.sel_underlineThickness); | |
445 } | |
446 | |
447 public static void useFont (NSString fontName) | |
448 { | |
449 OS.objc_msgSend(OS.class_NSFont, OS.sel_useFont_1, fontName !is null ? fontName.id_ : null); | |
450 } | |
451 | |
452 public static NSFont userFixedPitchFontOfSize (CGFloat fontSize) | |
453 { | |
454 objc.id result = OS.objc_msgSend(OS.class_NSFont, OS.sel_userFixedPitchFontOfSize_1, fontSize); | |
455 return result !is null ? new NSFont(result) : null; | |
456 } | |
457 | |
458 public static NSFont userFontOfSize (CGFloat fontSize) | |
459 { | |
460 objc.id result = OS.objc_msgSend(OS.class_NSFont, OS.sel_userFontOfSize_1, fontSize); | |
461 return result !is null ? new NSFont(result) : null; | |
462 } | |
463 | |
464 public CGFloat widthOfString (NSString string) | |
465 { | |
466 return cast(CGFloat) OS.objc_msgSend_fpret(this.id_, OS.sel_widthOfString_1, string !is null ? string.id_ : null); | |
467 } | |
468 | |
469 public CGFloat xHeight () | |
470 { | |
471 return cast(CGFloat) OS.objc_msgSend_fpret(this.id_, OS.sel_xHeight); | |
472 } | |
473 | 88 |
474 } | 89 } |