1{%mainunit appkit.pas} 2(* 3 NSFont.h 4 Application Kit 5 Copyright (c) 1994-2005, Apple Computer, Inc. 6 All rights reserved. 7*) 8 9{$ifdef HEADER} 10{$ifndef NSFONT_PAS_H} 11{$define NSFONT_PAS_H} 12 13 14//#import <Foundation/NSObject.h> 15//#import <Foundation/NSString.h> // for NSStringEncoding 16//#import <AppKit/AppKitDefines.h> 17//#import <AppKit/NSCell.h> // for NSControlSize 18type 19 NSGlyph = LongWord; 20 21const 22 NSControlGlyph = $00FFFFFF; 23 NSNullGlyph = $0; 24 25//const float *NSFontIdentityMatrix; 26type 27 NSMultibyteGlyphPacking = ( 28 NSNativeShortGlyphPacking = 5 29 ); 30 31 32type 33 NSFontRenderingMode = ( 34 NSFontDefaultRenderingMode = 0, 35 NSFontAntialiasedRenderingMode = 1, 36 NSFontIntegerAdvancementsRenderingMode = 2, 37 NSFontAntialiasedIntegerAdvancementsRenderingMode = 3 38 ); 39 40 41//NSString *NSAntialiasThresholdChangedNotification AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; 42//NSString *NSFontSetChangedNotification AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; 43type 44 NSGlyphRelation = ( 45 NSGlyphBelow = 1, 46 NSGlyphAbove = 2 47 ); 48 49 50 // Only NSNativeShortGlyphPacking is supported on Mac OS X. 51const 52 NSOneByteGlyphPacking = 0; 53 NSJapaneseEUCGlyphPacking = NSOneByteGlyphPacking + 1; 54 NSAsciiWithDoubleByteEUCGlyphPacking = NSOneByteGlyphPacking + 2; 55 NSTwoByteGlyphPacking = NSOneByteGlyphPacking + 3; 56 NSFourByteGlyphPacking = NSOneByteGlyphPacking + 4; 57 58//NSString *NSAFMFamilyName AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4; 59//NSString *NSAFMFontName AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4; 60//NSString *NSAFMFormatVersion AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4; 61//NSString *NSAFMFullName AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4; 62//NSString *NSAFMNotice AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4; 63//NSString *NSAFMVersion AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4; 64//NSString *NSAFMWeight AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4; 65//NSString *NSAFMEncodingScheme AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4; 66//NSString *NSAFMCharacterSet AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4; 67//NSString *NSAFMCapHeight AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4; 68//NSString *NSAFMXHeight AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4; 69//NSString *NSAFMAscender AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4; 70//NSString *NSAFMDescender AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4; 71//NSString *NSAFMUnderlinePosition AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4; 72//NSString *NSAFMUnderlineThickness AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4; 73//NSString *NSAFMItalicAngle AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4; 74//NSString *NSAFMMappingScheme AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4; 75{$endif} 76{$endif} 77 78{$ifdef FORWARD} 79 NSFont = class; 80 81{$endif} 82 83{$ifdef CLASSES} 84{$ifndef NSFONT_PAS_C} 85{$define NSFONT_PAS_C} 86 87 88 { NSFont } 89 90 NSFont = class(NSObject) 91 public 92 class function getClass: lobjc.id; override; 93 // All instance variables are private 94 // ******** Factory ******** 95 constructor fontWithName_size(_fontName: CFStringRef; _fontSize: Single); 96 constructor fontWithName_matrix(_fontName: CFStringRef; _fontMatrix: Single); 97 constructor fontWithDescriptor_size(_fontDescriptor: lobjc.id {NSFontDescriptor}; _fontSize: Single); 98 // Instantiates an NSFont object matching fontDescriptor. If textTransform is non-nil, 99 // it has precedence over NSFontMatrixAttribute in fontDescriptor. 100 constructor fontWithDescriptor_textTransform(_fontDescriptor: lobjc.id {NSFontDescriptor}; _textTransform: lobjc.id {NSAffineTransform}); 101 constructor userFontOfSize(_fontSize: Single); 102 // Aqua Application font 103 constructor userFixedPitchFontOfSize(_fontSize: Single); 104 // Aqua fixed-pitch font 105 class procedure setUserFont(_aFont: lobjc.id {NSFont}); 106 // set preference for Application font. 107 class procedure setUserFixedPitchFont(_aFont: lobjc.id {NSFont}); 108 // set preference for fixed-pitch. 109 // UI font settings 110 constructor systemFontOfSize(_fontSize: Single); 111 // Aqua System font 112 constructor boldSystemFontOfSize(_fontSize: Single); 113 // Aqua System font (emphasized) 114 constructor labelFontOfSize(_fontSize: Single); 115 // Aqua label font 116 constructor titleBarFontOfSize(_fontSize: Single); 117 constructor menuFontOfSize(_fontSize: Single); 118 constructor menuBarFontOfSize(_fontSize: Single); 119 constructor messageFontOfSize(_fontSize: Single); 120 constructor paletteFontOfSize(_fontSize: Single); 121 constructor toolTipsFontOfSize(_fontSize: Single); 122 constructor controlContentFontOfSize(_fontSize: Single); 123 // UI font size settings 124 class function systemFontSize: Single; 125 // size of the standard System font. 126 class function smallSystemFontSize: Single; 127 // size of standard small System font. 128 class function labelFontSize: Single; 129 class function systemFontSizeForControlSize(_controlSize: NSControlSize): Single; 130 function fontName: CFStringRef; 131 function pointSize: Single; 132 function matrix: Single; 133 function familyName: CFStringRef; 134 function displayName: CFStringRef; 135 function fontDescriptor: lobjc.id;{NSFontDescriptor} 136 {.$ifdef MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4} 137 function textTransform: lobjc.id;{NSAffineTransform} 138 function numberOfGlyphs: LongWord; 139 function mostCompatibleStringEncoding: NSStringEncoding; 140 function glyphWithName(_aName: CFStringRef): NSGlyph; 141 function coveredCharacterSet: CFCharacterSetRef; 142 function boundingRectForFont: NSRect; 143 function maximumAdvancement: NSSize; 144 function ascender: Single; 145 function descender: Single; 146 function leading: Single; 147 function underlinePosition: Single; 148 function underlineThickness: Single; 149 function italicAngle: Single; 150 function capHeight: Single; 151 function xHeight: Single; 152 function isFixedPitch: LongBool; 153 // ******** Glyph metrics ******** 154 function boundingRectForGlyph(_aGlyph: NSGlyph): NSRect; 155 function advancementForGlyph(_ag: NSGlyph): NSSize; 156// procedure getBoundingRects_forGlyphs_count(_bounds: NSRectArray; _glyphs: NSGlyph; _glyphCount: LongWord); 157// procedure getAdvancements_forGlyphs_count(_advancements: NSSizeArray; _glyphs: NSGlyph; _glyphCount: LongWord); 158// procedure getAdvancements_forPackedGlyphs_length(_advancements: NSSizeArray; _packedGlyphs: Pointer; _length: LongWord); 159 procedure set_; 160 procedure setInContext(_graphicsContext: lobjc.id {NSGraphicsContext}); 161 function printerFont: lobjc.id;{NSFont} 162 function screenFont: lobjc.id;{NSFont} 163 function screenFontWithRenderingMode(_renderingMode: NSFontRenderingMode): lobjc.id;{NSFont} 164 function renderingMode: NSFontRenderingMode; 165 class procedure useFont(_fontName: CFStringRef); 166 // This is now automatically handled by Quartz. 167 function widthOfString(__string: CFStringRef): Single; 168 // This API never returns correct value. Use NSStringDrawing API instead. 169 function isBaseFont: LongBool; 170 function afmDictionary: CFDictionaryRef; 171 function glyphIsEncoded(_aGlyph: NSGlyph): LongBool; 172 // Can be deduced by aGlyph < [NSFont numberOfGlyphs] since only NSNativeShortGlyphPacking 173 // is supported. 174 function defaultLineHeightForFont: Single; 175 // Use -[NSLayoutManager defaultLineHeightForFont:] instead. 176 class function preferredFontNames: CFArrayRef; 177 // NSFontCascadeListAttribute offers more powerful font substitution management 178 class procedure setPreferredFontNames(_fontNameArray: CFArrayRef); 179 function encodingScheme: CFStringRef; 180 function glyphPacking: NSMultibyteGlyphPacking; 181 // The context-sensitive inter-glyph spacing is now performed at the typesetting stage. 182 function positionOfGlyph_precededByGlyph_isNominal(_curGlyph: NSGlyph; _prevGlyph: NSGlyph; _nominal: LongBool): NSPoint; 183 function positionsForCompositeSequence_numberOfGlyphs_pointArray(_someGlyphs: NSGlyph; _numGlyphs: Integer; _points: NSPointArray): Integer; 184 function positionOfGlyph_struckOverGlyph_metricsExist(_curGlyph: NSGlyph; _prevGlyph: NSGlyph; _exist: LongBool): NSPoint; 185 function positionOfGlyph_struckOverRect_metricsExist(_aGlyph: NSGlyph; _aRect: NSRect; _exist: LongBool): NSPoint; 186 function positionOfGlyph_forCharacter_struckOverRect(_aGlyph: NSGlyph; _aChar: unichar; _aRect: NSRect): NSPoint; 187// function positionOfGlyph_withRelation_toBaseGlyph_totalAdvancement_metricsExist(_thisGlyph: NSGlyph; _rel: NSGlyphRelation; _baseGlyph: NSGlyph; _adv: NSSizePointer; _exist: LongBool): NSPoint; 188 end; 189 190{$endif} 191{$endif} 192 193{$ifdef IMPLEMENTATION} 194const 195 StrNSFont_NSFont = 'NSFont'; 196 StrNSFont_fontWithName_size = 'fontWithName:size:'; 197 StrNSFont_fontWithName_matrix = 'fontWithName:matrix:'; 198 StrNSFont_fontWithDescriptor_size = 'fontWithDescriptor:size:'; 199 StrNSFont_fontWithDescriptor_textTransform = 'fontWithDescriptor:textTransform:'; 200 StrNSFont_userFontOfSize = 'userFontOfSize:'; 201 StrNSFont_userFixedPitchFontOfSize = 'userFixedPitchFontOfSize:'; 202 StrNSFont_setUserFont = 'setUserFont:'; 203 StrNSFont_setUserFixedPitchFont = 'setUserFixedPitchFont:'; 204 StrNSFont_systemFontOfSize = 'systemFontOfSize:'; 205 StrNSFont_boldSystemFontOfSize = 'boldSystemFontOfSize:'; 206 StrNSFont_labelFontOfSize = 'labelFontOfSize:'; 207 StrNSFont_titleBarFontOfSize = 'titleBarFontOfSize:'; 208 StrNSFont_menuFontOfSize = 'menuFontOfSize:'; 209 StrNSFont_menuBarFontOfSize = 'menuBarFontOfSize:'; 210 StrNSFont_messageFontOfSize = 'messageFontOfSize:'; 211 StrNSFont_paletteFontOfSize = 'paletteFontOfSize:'; 212 StrNSFont_toolTipsFontOfSize = 'toolTipsFontOfSize:'; 213 StrNSFont_controlContentFontOfSize = 'controlContentFontOfSize:'; 214 StrNSFont_systemFontSize = 'systemFontSize'; 215 StrNSFont_smallSystemFontSize = 'smallSystemFontSize'; 216 StrNSFont_labelFontSize = 'labelFontSize'; 217 StrNSFont_systemFontSizeForControlSize = 'systemFontSizeForControlSize:'; 218 StrNSFont_fontName = 'fontName'; 219 StrNSFont_pointSize = 'pointSize'; 220 StrNSFont_matrix = 'matrix'; 221 StrNSFont_familyName = 'familyName'; 222 StrNSFont_displayName = 'displayName'; 223 StrNSFont_fontDescriptor = 'fontDescriptor'; 224 StrNSFont_textTransform = 'textTransform'; 225 StrNSFont_numberOfGlyphs = 'numberOfGlyphs'; 226 StrNSFont_mostCompatibleStringEncoding = 'mostCompatibleStringEncoding'; 227 StrNSFont_glyphWithName = 'glyphWithName:'; 228 StrNSFont_coveredCharacterSet = 'coveredCharacterSet'; 229 StrNSFont_boundingRectForFont = 'boundingRectForFont'; 230 StrNSFont_maximumAdvancement = 'maximumAdvancement'; 231 StrNSFont_ascender = 'ascender'; 232 StrNSFont_descender = 'descender'; 233 StrNSFont_leading = 'leading'; 234 StrNSFont_underlinePosition = 'underlinePosition'; 235 StrNSFont_underlineThickness = 'underlineThickness'; 236 StrNSFont_italicAngle = 'italicAngle'; 237 StrNSFont_capHeight = 'capHeight'; 238 StrNSFont_xHeight = 'xHeight'; 239 StrNSFont_isFixedPitch = 'isFixedPitch'; 240 StrNSFont_boundingRectForGlyph = 'boundingRectForGlyph:'; 241 StrNSFont_advancementForGlyph = 'advancementForGlyph:'; 242 {%H-}StrNSFont_getBoundingRects_forGlyphs_count = 'getBoundingRects:forGlyphs:count:'; 243 {%H-}StrNSFont_getAdvancements_forGlyphs_count = 'getAdvancements:forGlyphs:count:'; 244 {%H-}StrNSFont_getAdvancements_forPackedGlyphs_length = 'getAdvancements:forPackedGlyphs:length:'; 245 StrNSFont_set = 'set'; 246 StrNSFont_setInContext = 'setInContext:'; 247 StrNSFont_printerFont = 'printerFont'; 248 StrNSFont_screenFont = 'screenFont'; 249 StrNSFont_screenFontWithRenderingMode = 'screenFontWithRenderingMode:'; 250 StrNSFont_renderingMode = 'renderingMode'; 251 252 StrNSFont_useFont = 'useFont:'; 253 StrNSFont_widthOfString = 'widthOfString:'; 254 StrNSFont_isBaseFont = 'isBaseFont'; 255 StrNSFont_afmDictionary = 'afmDictionary'; 256 StrNSFont_glyphIsEncoded = 'glyphIsEncoded:'; 257 StrNSFont_defaultLineHeightForFont = 'defaultLineHeightForFont'; 258 StrNSFont_preferredFontNames = 'preferredFontNames'; 259 StrNSFont_setPreferredFontNames = 'setPreferredFontNames:'; 260 StrNSFont_encodingScheme = 'encodingScheme'; 261 StrNSFont_glyphPacking = 'glyphPacking'; 262 StrNSFont_positionOfGlyph_precededByGlyph_isNominal = 'positionOfGlyph:precededByGlyph:isNominal:'; 263 StrNSFont_positionsForCompositeSequence_numberOfGlyphs_pointArray = 'positionsForCompositeSequence:numberOfGlyphs:pointArray:'; 264 StrNSFont_positionOfGlyph_struckOverGlyph_metricsExist = 'positionOfGlyph:struckOverGlyph:metricsExist:'; 265 StrNSFont_positionOfGlyph_struckOverRect_metricsExist = 'positionOfGlyph:struckOverRect:metricsExist:'; 266 StrNSFont_positionOfGlyph_forCharacter_struckOverRect = 'positionOfGlyph:forCharacter:struckOverRect:'; 267 {%H-}StrNSFont_positionOfGlyph_withRelation_toBaseGlyph_totalAdvancement_metricsExist = 'positionOfGlyph:withRelation:toBaseGlyph:totalAdvancement:metricsExist:'; 268 269{ NSFont } 270 271class function NSFont.getClass: lobjc.id; 272begin 273 Result := objc_getClass(StrNSFont_NSFont); 274end; 275 276constructor NSFont.fontWithName_size(_fontName: CFStringRef; _fontSize: Single); 277type 278 TmsgSendWrapper = function (param1: lobjc.id; param2: SEL;_fontName: CFStringRef; _fontSize: Single): lobjc.id; cdecl; 279var 280 vmethod: TmsgSendWrapper; 281begin 282 ClassID := getClass(); 283 vmethod := TmsgSendWrapper(@objc_msgSend); 284 Handle := vmethod(ClassID, sel_registerName(PChar(StrNSFont_fontWithName_size)), _fontName, _fontSize); 285end; 286 287constructor NSFont.fontWithName_matrix(_fontName: CFStringRef; _fontMatrix: Single); 288type 289 TmsgSendWrapper = function (param1: lobjc.id; param2: SEL;_fontName: CFStringRef; _fontMatrix: Single): lobjc.id; cdecl; 290var 291 vmethod: TmsgSendWrapper; 292begin 293 ClassID := getClass(); 294 vmethod := TmsgSendWrapper(@objc_msgSend); 295 Handle := vmethod(ClassID, sel_registerName(PChar(StrNSFont_fontWithName_matrix)), _fontName, _fontMatrix); 296end; 297 298constructor NSFont.fontWithDescriptor_size(_fontDescriptor: lobjc.id {NSFontDescriptor}; _fontSize: Single); 299type 300 TmsgSendWrapper = function (param1: lobjc.id; param2: SEL;_fontDescriptor: lobjc.id {NSFontDescriptor}; _fontSize: Single): lobjc.id; cdecl; 301var 302 vmethod: TmsgSendWrapper; 303begin 304 ClassID := getClass(); 305 vmethod := TmsgSendWrapper(@objc_msgSend); 306 Handle := vmethod(ClassID, sel_registerName(PChar(StrNSFont_fontWithDescriptor_size)), _fontDescriptor, _fontSize); 307end; 308 309constructor NSFont.fontWithDescriptor_textTransform(_fontDescriptor: lobjc.id {NSFontDescriptor}; _textTransform: lobjc.id {NSAffineTransform}); 310type 311 TmsgSendWrapper = function (param1: lobjc.id; param2: SEL;_fontDescriptor: lobjc.id {NSFontDescriptor}; _textTransform: lobjc.id {NSAffineTransform}): lobjc.id; cdecl; 312var 313 vmethod: TmsgSendWrapper; 314begin 315 ClassID := getClass(); 316 vmethod := TmsgSendWrapper(@objc_msgSend); 317 Handle := vmethod(ClassID, sel_registerName(PChar(StrNSFont_fontWithDescriptor_textTransform)), _fontDescriptor, _textTransform); 318end; 319 320constructor NSFont.userFontOfSize(_fontSize: Single); 321type 322 TmsgSendWrapper = function (param1: lobjc.id; param2: SEL;_fontSize: Single): lobjc.id; cdecl; 323var 324 vmethod: TmsgSendWrapper; 325begin 326 ClassID := getClass(); 327 vmethod := TmsgSendWrapper(@objc_msgSend); 328 Handle := vmethod(ClassID, sel_registerName(PChar(StrNSFont_userFontOfSize)), _fontSize); 329end; 330 331constructor NSFont.userFixedPitchFontOfSize(_fontSize: Single); 332type 333 TmsgSendWrapper = function (param1: lobjc.id; param2: SEL;_fontSize: Single): lobjc.id; cdecl; 334var 335 vmethod: TmsgSendWrapper; 336begin 337 ClassID := getClass(); 338 vmethod := TmsgSendWrapper(@objc_msgSend); 339 Handle := vmethod(ClassID, sel_registerName(PChar(StrNSFont_userFixedPitchFontOfSize)), _fontSize); 340end; 341 342class procedure NSFont.setUserFont(_aFont: lobjc.id {NSFont}); 343type 344 TmsgSendWrapper = procedure (param1: lobjc.id; param2: SEL;_aFont: lobjc.id {NSFont}); cdecl; 345var 346 vmethod: TmsgSendWrapper; 347begin 348 vmethod := TmsgSendWrapper(@objc_msgSend); 349 vmethod(getClass, sel_registerName(PChar(StrNSFont_setUserFont)), _aFont); 350end; 351 352class procedure NSFont.setUserFixedPitchFont(_aFont: lobjc.id {NSFont}); 353type 354 TmsgSendWrapper = procedure (param1: lobjc.id; param2: SEL;_aFont: lobjc.id {NSFont}); cdecl; 355var 356 vmethod: TmsgSendWrapper; 357begin 358 vmethod := TmsgSendWrapper(@objc_msgSend); 359 vmethod(getClass, sel_registerName(PChar(StrNSFont_setUserFixedPitchFont)), _aFont); 360end; 361 362constructor NSFont.systemFontOfSize(_fontSize: Single); 363type 364 TmsgSendWrapper = function (param1: lobjc.id; param2: SEL;_fontSize: Single): lobjc.id; cdecl; 365var 366 vmethod: TmsgSendWrapper; 367begin 368 ClassID := getClass(); 369 vmethod := TmsgSendWrapper(@objc_msgSend); 370 Handle := vmethod(ClassID, sel_registerName(PChar(StrNSFont_systemFontOfSize)), _fontSize); 371end; 372 373constructor NSFont.boldSystemFontOfSize(_fontSize: Single); 374type 375 TmsgSendWrapper = function (param1: lobjc.id; param2: SEL;_fontSize: Single): lobjc.id; cdecl; 376var 377 vmethod: TmsgSendWrapper; 378begin 379 ClassID := getClass(); 380 vmethod := TmsgSendWrapper(@objc_msgSend); 381 Handle := vmethod(ClassID, sel_registerName(PChar(StrNSFont_boldSystemFontOfSize)), _fontSize); 382end; 383 384constructor NSFont.labelFontOfSize(_fontSize: Single); 385type 386 TmsgSendWrapper = function (param1: lobjc.id; param2: SEL;_fontSize: Single): lobjc.id; cdecl; 387var 388 vmethod: TmsgSendWrapper; 389begin 390 ClassID := getClass(); 391 vmethod := TmsgSendWrapper(@objc_msgSend); 392 Handle := vmethod(ClassID, sel_registerName(PChar(StrNSFont_labelFontOfSize)), _fontSize); 393end; 394 395constructor NSFont.titleBarFontOfSize(_fontSize: Single); 396type 397 TmsgSendWrapper = function (param1: lobjc.id; param2: SEL;_fontSize: Single): lobjc.id; cdecl; 398var 399 vmethod: TmsgSendWrapper; 400begin 401 ClassID := getClass(); 402 vmethod := TmsgSendWrapper(@objc_msgSend); 403 Handle := vmethod(ClassID, sel_registerName(PChar(StrNSFont_titleBarFontOfSize)), _fontSize); 404end; 405 406constructor NSFont.menuFontOfSize(_fontSize: Single); 407type 408 TmsgSendWrapper = function (param1: lobjc.id; param2: SEL;_fontSize: Single): lobjc.id; cdecl; 409var 410 vmethod: TmsgSendWrapper; 411begin 412 ClassID := getClass(); 413 vmethod := TmsgSendWrapper(@objc_msgSend); 414 Handle := vmethod(ClassID, sel_registerName(PChar(StrNSFont_menuFontOfSize)), _fontSize); 415end; 416 417constructor NSFont.menuBarFontOfSize(_fontSize: Single); 418type 419 TmsgSendWrapper = function (param1: lobjc.id; param2: SEL;_fontSize: Single): lobjc.id; cdecl; 420var 421 vmethod: TmsgSendWrapper; 422begin 423 ClassID := getClass(); 424 vmethod := TmsgSendWrapper(@objc_msgSend); 425 Handle := vmethod(ClassID, sel_registerName(PChar(StrNSFont_menuBarFontOfSize)), _fontSize); 426end; 427 428constructor NSFont.messageFontOfSize(_fontSize: Single); 429type 430 TmsgSendWrapper = function (param1: lobjc.id; param2: SEL;_fontSize: Single): lobjc.id; cdecl; 431var 432 vmethod: TmsgSendWrapper; 433begin 434 ClassID := getClass(); 435 vmethod := TmsgSendWrapper(@objc_msgSend); 436 Handle := vmethod(ClassID, sel_registerName(PChar(StrNSFont_messageFontOfSize)), _fontSize); 437end; 438 439constructor NSFont.paletteFontOfSize(_fontSize: Single); 440type 441 TmsgSendWrapper = function (param1: lobjc.id; param2: SEL;_fontSize: Single): lobjc.id; cdecl; 442var 443 vmethod: TmsgSendWrapper; 444begin 445 ClassID := getClass(); 446 vmethod := TmsgSendWrapper(@objc_msgSend); 447 Handle := vmethod(ClassID, sel_registerName(PChar(StrNSFont_paletteFontOfSize)), _fontSize); 448end; 449 450constructor NSFont.toolTipsFontOfSize(_fontSize: Single); 451type 452 TmsgSendWrapper = function (param1: lobjc.id; param2: SEL;_fontSize: Single): lobjc.id; cdecl; 453var 454 vmethod: TmsgSendWrapper; 455begin 456 ClassID := getClass(); 457 vmethod := TmsgSendWrapper(@objc_msgSend); 458 Handle := vmethod(ClassID, sel_registerName(PChar(StrNSFont_toolTipsFontOfSize)), _fontSize); 459end; 460 461constructor NSFont.controlContentFontOfSize(_fontSize: Single); 462type 463 TmsgSendWrapper = function (param1: lobjc.id; param2: SEL;_fontSize: Single): lobjc.id; cdecl; 464var 465 vmethod: TmsgSendWrapper; 466begin 467 ClassID := getClass(); 468 vmethod := TmsgSendWrapper(@objc_msgSend); 469 Handle := vmethod(ClassID, sel_registerName(PChar(StrNSFont_controlContentFontOfSize)), _fontSize); 470end; 471 472class function NSFont.systemFontSize: Single; 473begin 474 Result := Single(objc_msgSend(getClass, sel_registerName(PChar(StrNSFont_systemFontSize)), [])); 475end; 476 477class function NSFont.smallSystemFontSize: Single; 478begin 479 Result := Single(objc_msgSend(getClass, sel_registerName(PChar(StrNSFont_smallSystemFontSize)), [])); 480end; 481 482class function NSFont.labelFontSize: Single; 483begin 484 Result := Single(objc_msgSend(getClass, sel_registerName(PChar(StrNSFont_labelFontSize)), [])); 485end; 486 487class function NSFont.systemFontSizeForControlSize(_controlSize: NSControlSize): Single; 488type 489 TmsgSendWrapper = function (param1: lobjc.id; param2: SEL;_controlSize: NSControlSize): Single; cdecl; 490var 491 vmethod: TmsgSendWrapper; 492begin 493 vmethod := TmsgSendWrapper(@objc_msgSend); 494 Result := Single(vmethod(getClass, sel_registerName(PChar(StrNSFont_systemFontSizeForControlSize)), _controlSize)); 495end; 496 497function NSFont.fontName: CFStringRef; 498begin 499 Result := CFStringRef(objc_msgSend(Handle, sel_registerName(PChar(StrNSFont_fontName)), [])); 500end; 501 502function NSFont.pointSize: Single; 503begin 504 Result := Single(objc_msgSend(Handle, sel_registerName(PChar(StrNSFont_pointSize)), [])); 505end; 506 507function NSFont.matrix: Single; 508begin 509 Result := Single(objc_msgSend(Handle, sel_registerName(PChar(StrNSFont_matrix)), [])); 510end; 511 512function NSFont.familyName: CFStringRef; 513begin 514 Result := CFStringRef(objc_msgSend(Handle, sel_registerName(PChar(StrNSFont_familyName)), [])); 515end; 516 517function NSFont.displayName: CFStringRef; 518begin 519 Result := CFStringRef(objc_msgSend(Handle, sel_registerName(PChar(StrNSFont_displayName)), [])); 520end; 521 522function NSFont.fontDescriptor: lobjc.id; 523begin 524 Result := lobjc.id(objc_msgSend(Handle, sel_registerName(PChar(StrNSFont_fontDescriptor)), [])); 525end; 526 527{.$ifdef MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4} 528function NSFont.textTransform: lobjc.id; 529begin 530 Result := lobjc.id(objc_msgSend(Handle, sel_registerName(PChar(StrNSFont_textTransform)), [])); 531end; 532 533function NSFont.numberOfGlyphs: LongWord; 534begin 535 Result := {%H-}LongWord(objc_msgSend(Handle, sel_registerName(PChar(StrNSFont_numberOfGlyphs)), [])); 536end; 537 538function NSFont.mostCompatibleStringEncoding: NSStringEncoding; 539begin 540 Result := {%H-}NSStringEncoding(objc_msgSend(Handle, sel_registerName(PChar(StrNSFont_mostCompatibleStringEncoding)), [])); 541end; 542 543function NSFont.glyphWithName(_aName: CFStringRef): NSGlyph; 544type 545 TmsgSendWrapper = function (param1: lobjc.id; param2: SEL;_aName: CFStringRef): NSGlyph; cdecl; 546var 547 vmethod: TmsgSendWrapper; 548begin 549 vmethod := TmsgSendWrapper(@objc_msgSend); 550 Result := NSGlyph(vmethod(Handle, sel_registerName(PChar(StrNSFont_glyphWithName)), _aName)); 551end; 552 553function NSFont.coveredCharacterSet: CFCharacterSetRef; 554begin 555 Result := CFCharacterSetRef(objc_msgSend(Handle, sel_registerName(PChar(StrNSFont_coveredCharacterSet)), [])); 556end; 557 558function NSFont.boundingRectForFont: NSRect; 559begin 560 objc_msgSend_stret(@Result, Handle, sel_registerName(PChar(StrNSFont_boundingRectForFont)), []); 561end; 562 563function NSFont.maximumAdvancement: NSSize; 564begin 565 objc_msgSend_stret(@Result, Handle, sel_registerName(PChar(StrNSFont_maximumAdvancement)), []); 566end; 567 568function NSFont.ascender: Single; 569begin 570 Result := Single(objc_msgSend(Handle, sel_registerName(PChar(StrNSFont_ascender)), [])); 571end; 572 573function NSFont.descender: Single; 574begin 575 Result := Single(objc_msgSend(Handle, sel_registerName(PChar(StrNSFont_descender)), [])); 576end; 577 578function NSFont.leading: Single; 579begin 580 Result := Single(objc_msgSend(Handle, sel_registerName(PChar(StrNSFont_leading)), [])); 581end; 582 583function NSFont.underlinePosition: Single; 584begin 585 Result := Single(objc_msgSend(Handle, sel_registerName(PChar(StrNSFont_underlinePosition)), [])); 586end; 587 588function NSFont.underlineThickness: Single; 589begin 590 Result := Single(objc_msgSend(Handle, sel_registerName(PChar(StrNSFont_underlineThickness)), [])); 591end; 592 593function NSFont.italicAngle: Single; 594begin 595 Result := Single(objc_msgSend(Handle, sel_registerName(PChar(StrNSFont_italicAngle)), [])); 596end; 597 598function NSFont.capHeight: Single; 599begin 600 Result := Single(objc_msgSend(Handle, sel_registerName(PChar(StrNSFont_capHeight)), [])); 601end; 602 603function NSFont.xHeight: Single; 604begin 605 Result := Single(objc_msgSend(Handle, sel_registerName(PChar(StrNSFont_xHeight)), [])); 606end; 607 608function NSFont.isFixedPitch: LongBool; 609begin 610 Result := {%H-}LongBool(objc_msgSend(Handle, sel_registerName(PChar(StrNSFont_isFixedPitch)), [])); 611end; 612 613function NSFont.boundingRectForGlyph(_aGlyph: NSGlyph): NSRect; 614type 615 TmsgSendWrapper = procedure (result_param: Pointer; param1: lobjc.id; param2: SEL;_aGlyph: NSGlyph); cdecl; 616var 617 vmethod: TmsgSendWrapper; 618begin 619 vmethod := TmsgSendWrapper(@objc_msgSend_fpret); 620 vmethod(@Result, Handle, sel_registerName(PChar(StrNSFont_boundingRectForGlyph)), _aGlyph); 621end; 622 623function NSFont.advancementForGlyph(_ag: NSGlyph): NSSize; 624type 625 TmsgSendWrapper = procedure (result_param: Pointer; param1: lobjc.id; param2: SEL;_ag: NSGlyph); cdecl; 626var 627 vmethod: TmsgSendWrapper; 628begin 629 vmethod := TmsgSendWrapper(@objc_msgSend_fpret); 630 vmethod(@Result, Handle, sel_registerName(PChar(StrNSFont_advancementForGlyph)), _ag); 631end; 632 633{procedure NSFont.getBoundingRects_forGlyphs_count(_bounds: NSRectArray; _glyphs: NSGlyph; _glyphCount: LongWord); 634type 635 TmsgSendWrapper = procedure (param1: lobjc.id; param2: SEL;_bounds: NSRectArray; _glyphs: NSGlyph; _glyphCount: LongWord); cdecl; 636var 637 vmethod: TmsgSendWrapper; 638begin 639 vmethod := TmsgSendWrapper(@objc_msgSend); 640 vmethod(Handle, sel_registerName(PChar(StrNSFont_getBoundingRects_forGlyphs_count)), _bounds, _glyphs, _glyphCount); 641end; 642 643procedure NSFont.getAdvancements_forGlyphs_count(_advancements: NSSizeArray; _glyphs: NSGlyph; _glyphCount: LongWord); 644type 645 TmsgSendWrapper = procedure (param1: lobjc.id; param2: SEL;_advancements: NSSizeArray; _glyphs: NSGlyph; _glyphCount: LongWord); cdecl; 646var 647 vmethod: TmsgSendWrapper; 648begin 649 vmethod := TmsgSendWrapper(@objc_msgSend); 650 vmethod(Handle, sel_registerName(PChar(StrNSFont_getAdvancements_forGlyphs_count)), _advancements, _glyphs, _glyphCount); 651end; 652 653procedure NSFont.getAdvancements_forPackedGlyphs_length(_advancements: NSSizeArray; _packedGlyphs: Pointer; _length: LongWord); 654type 655 TmsgSendWrapper = procedure (param1: lobjc.id; param2: SEL;_advancements: NSSizeArray; _packedGlyphs: Pointer; _length: LongWord); cdecl; 656var 657 vmethod: TmsgSendWrapper; 658begin 659 vmethod := TmsgSendWrapper(@objc_msgSend); 660 vmethod(Handle, sel_registerName(PChar(StrNSFont_getAdvancements_forPackedGlyphs_length)), _advancements, _packedGlyphs, _length); 661end;} 662 663procedure NSFont.set_; 664begin 665 objc_msgSend(Handle, sel_registerName(PChar(StrNSFont_set)), []); 666end; 667 668procedure NSFont.setInContext(_graphicsContext: lobjc.id {NSGraphicsContext}); 669type 670 TmsgSendWrapper = procedure (param1: lobjc.id; param2: SEL;_graphicsContext: lobjc.id {NSGraphicsContext}); cdecl; 671var 672 vmethod: TmsgSendWrapper; 673begin 674 vmethod := TmsgSendWrapper(@objc_msgSend); 675 vmethod(Handle, sel_registerName(PChar(StrNSFont_setInContext)), _graphicsContext); 676end; 677 678function NSFont.printerFont: lobjc.id; 679begin 680 Result := lobjc.id(objc_msgSend(Handle, sel_registerName(PChar(StrNSFont_printerFont)), [])); 681end; 682 683function NSFont.screenFont: lobjc.id; 684begin 685 Result := lobjc.id(objc_msgSend(Handle, sel_registerName(PChar(StrNSFont_screenFont)), [])); 686end; 687 688function NSFont.screenFontWithRenderingMode(_renderingMode: NSFontRenderingMode): lobjc.id; 689type 690 TmsgSendWrapper = function (param1: lobjc.id; param2: SEL;_renderingMode: NSFontRenderingMode): lobjc.id; cdecl; 691var 692 vmethod: TmsgSendWrapper; 693begin 694 vmethod := TmsgSendWrapper(@objc_msgSend); 695 Result := lobjc.id(vmethod(Handle, sel_registerName(PChar(StrNSFont_screenFontWithRenderingMode)), _renderingMode)); 696end; 697 698function NSFont.renderingMode: NSFontRenderingMode; 699begin 700 Result := NSFontRenderingMode(objc_msgSend(Handle, sel_registerName(PChar(StrNSFont_renderingMode)), [])); 701end; 702 703class procedure NSFont.useFont(_fontName: CFStringRef); 704type 705 TmsgSendWrapper = procedure (param1: lobjc.id; param2: SEL;_fontName: CFStringRef); cdecl; 706var 707 vmethod: TmsgSendWrapper; 708begin 709 vmethod := TmsgSendWrapper(@objc_msgSend); 710 vmethod(getClass, sel_registerName(PChar(StrNSFont_useFont)), _fontName); 711end; 712 713function NSFont.widthOfString(__string: CFStringRef): Single; 714type 715 TmsgSendWrapper = function (param1: lobjc.id; param2: SEL;__string: CFStringRef): Single; cdecl; 716var 717 vmethod: TmsgSendWrapper; 718begin 719 vmethod := TmsgSendWrapper(@objc_msgSend); 720 Result := Single(vmethod(Handle, sel_registerName(PChar(StrNSFont_widthOfString)), __string)); 721end; 722 723function NSFont.isBaseFont: LongBool; 724begin 725 Result := {%H-}LongBool(objc_msgSend(Handle, sel_registerName(PChar(StrNSFont_isBaseFont)), [])); 726end; 727 728function NSFont.afmDictionary: CFDictionaryRef; 729begin 730 Result := CFDictionaryRef(objc_msgSend(Handle, sel_registerName(PChar(StrNSFont_afmDictionary)), [])); 731end; 732 733function NSFont.glyphIsEncoded(_aGlyph: NSGlyph): LongBool; 734type 735 TmsgSendWrapper = function (param1: lobjc.id; param2: SEL;_aGlyph: NSGlyph): LongBool; cdecl; 736var 737 vmethod: TmsgSendWrapper; 738begin 739 vmethod := TmsgSendWrapper(@objc_msgSend); 740 Result := LongBool(vmethod(Handle, sel_registerName(PChar(StrNSFont_glyphIsEncoded)), _aGlyph)); 741end; 742 743function NSFont.defaultLineHeightForFont: Single; 744begin 745 Result := Single(objc_msgSend(Handle, sel_registerName(PChar(StrNSFont_defaultLineHeightForFont)), [])); 746end; 747 748class function NSFont.preferredFontNames: CFArrayRef; 749begin 750 Result := CFArrayRef(objc_msgSend(getClass, sel_registerName(PChar(StrNSFont_preferredFontNames)), [])); 751end; 752 753class procedure NSFont.setPreferredFontNames(_fontNameArray: CFArrayRef); 754type 755 TmsgSendWrapper = procedure (param1: lobjc.id; param2: SEL;_fontNameArray: CFArrayRef); cdecl; 756var 757 vmethod: TmsgSendWrapper; 758begin 759 vmethod := TmsgSendWrapper(@objc_msgSend); 760 vmethod(getClass, sel_registerName(PChar(StrNSFont_setPreferredFontNames)), _fontNameArray); 761end; 762 763function NSFont.encodingScheme: CFStringRef; 764begin 765 Result := CFStringRef(objc_msgSend(Handle, sel_registerName(PChar(StrNSFont_encodingScheme)), [])); 766end; 767 768function NSFont.glyphPacking: NSMultibyteGlyphPacking; 769begin 770 Result := NSMultibyteGlyphPacking(objc_msgSend(Handle, sel_registerName(PChar(StrNSFont_glyphPacking)), [])); 771end; 772 773function NSFont.positionOfGlyph_precededByGlyph_isNominal(_curGlyph: NSGlyph; _prevGlyph: NSGlyph; _nominal: LongBool): NSPoint; 774type 775 TmsgSendWrapper = procedure (result_param: Pointer; param1: lobjc.id; param2: SEL;_curGlyph: NSGlyph; _prevGlyph: NSGlyph; _nominal: LongBool); cdecl; 776var 777 vmethod: TmsgSendWrapper; 778begin 779 vmethod := TmsgSendWrapper(@objc_msgSend_fpret); 780 vmethod(@Result, Handle, sel_registerName(PChar(StrNSFont_positionOfGlyph_precededByGlyph_isNominal)), _curGlyph, _prevGlyph, _nominal); 781end; 782 783function NSFont.positionsForCompositeSequence_numberOfGlyphs_pointArray(_someGlyphs: NSGlyph; _numGlyphs: Integer; _points: NSPointArray): Integer; 784type 785 TmsgSendWrapper = function (param1: lobjc.id; param2: SEL;_someGlyphs: NSGlyph; _numGlyphs: Integer; _points: NSPointArray): Integer; cdecl; 786var 787 vmethod: TmsgSendWrapper; 788begin 789 vmethod := TmsgSendWrapper(@objc_msgSend); 790 Result := Integer(vmethod(Handle, sel_registerName(PChar(StrNSFont_positionsForCompositeSequence_numberOfGlyphs_pointArray)), _someGlyphs, _numGlyphs, _points)); 791end; 792 793function NSFont.positionOfGlyph_struckOverGlyph_metricsExist(_curGlyph: NSGlyph; _prevGlyph: NSGlyph; _exist: LongBool): NSPoint; 794type 795 TmsgSendWrapper = procedure (result_param: Pointer; param1: lobjc.id; param2: SEL;_curGlyph: NSGlyph; _prevGlyph: NSGlyph; _exist: LongBool); cdecl; 796var 797 vmethod: TmsgSendWrapper; 798begin 799 vmethod := TmsgSendWrapper(@objc_msgSend_fpret); 800 vmethod(@Result, Handle, sel_registerName(PChar(StrNSFont_positionOfGlyph_struckOverGlyph_metricsExist)), _curGlyph, _prevGlyph, _exist); 801end; 802 803function NSFont.positionOfGlyph_struckOverRect_metricsExist(_aGlyph: NSGlyph; _aRect: NSRect; _exist: LongBool): NSPoint; 804type 805 TmsgSendWrapper = procedure (result_param: Pointer; param1: lobjc.id; param2: SEL;_aGlyph: NSGlyph; _aRect: NSRect; _exist: LongBool); cdecl; 806var 807 vmethod: TmsgSendWrapper; 808begin 809 vmethod := TmsgSendWrapper(@objc_msgSend_fpret); 810 vmethod(@Result, Handle, sel_registerName(PChar(StrNSFont_positionOfGlyph_struckOverRect_metricsExist)), _aGlyph, _aRect, _exist); 811end; 812 813function NSFont.positionOfGlyph_forCharacter_struckOverRect(_aGlyph: NSGlyph; _aChar: unichar; _aRect: NSRect): NSPoint; 814type 815 TmsgSendWrapper = procedure (result_param: Pointer; param1: lobjc.id; param2: SEL;_aGlyph: NSGlyph; _aChar: unichar; _aRect: NSRect); cdecl; 816var 817 vmethod: TmsgSendWrapper; 818begin 819 vmethod := TmsgSendWrapper(@objc_msgSend_fpret); 820 vmethod(@Result, Handle, sel_registerName(PChar(StrNSFont_positionOfGlyph_forCharacter_struckOverRect)), _aGlyph, _aChar, _aRect); 821end; 822 823{function NSFont.positionOfGlyph_withRelation_toBaseGlyph_totalAdvancement_metricsExist(_thisGlyph: NSGlyph; _rel: NSGlyphRelation; _baseGlyph: NSGlyph; _adv: NSSizePointer; _exist: LongBool): NSPoint; 824type 825 TmsgSendWrapper = procedure (result_param: Pointer; param1: lobjc.id; param2: SEL;_thisGlyph: NSGlyph; _rel: NSGlyphRelation; _baseGlyph: NSGlyph; _adv: NSSizePointer; _exist: LongBool); cdecl; 826var 827 vmethod: TmsgSendWrapper; 828begin 829 vmethod := TmsgSendWrapper(@objc_msgSend_fpret); 830 vmethod(@Result, Handle, sel_registerName(PChar(StrNSFont_positionOfGlyph_withRelation_toBaseGlyph_totalAdvancement_metricsExist)), _thisGlyph, _rel, _baseGlyph, _adv, _exist); 831end;} 832 833{$endif} 834