Mercurial > projects > dstep
comparison dstep/appkit/NSTypesetter.d @ 16:19885b43130e
Huge update, the bridge actually works now
author | Jacob Carlborg <doob@me.com> |
---|---|
date | Sun, 03 Jan 2010 22:06:11 +0100 |
parents | |
children | b9de51448c6b |
comparison
equal
deleted
inserted
replaced
15:7ff919f595d5 | 16:19885b43130e |
---|---|
1 /** | |
2 * Copyright: Copyright (c) 2009 Jacob Carlborg. | |
3 * Authors: Jacob Carlborg | |
4 * Version: Initial created: Sep 24, 2009 | |
5 * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) | |
6 */ | |
7 module dstep.appkit.NSTypesetter; | |
8 | |
9 import dstep.appkit.NSFont; | |
10 import dstep.appkit.NSLayoutManager; | |
11 import dstep.appkit.NSParagraphStyle; | |
12 import dstep.appkit.NSSimpleHorizontalTypesetter; | |
13 import dstep.appkit.NSTextContainer; | |
14 import dstep.applicationservices.coregraphics.CGBase; | |
15 import dstep.corefoundation.CFCharacterSet; | |
16 import dstep.foundation.NSArray; | |
17 import dstep.foundation.NSAttributedString; | |
18 import dstep.foundation.NSDictionary; | |
19 import dstep.foundation.NSGeometry; | |
20 import dstep.foundation.NSObjCRuntime; | |
21 import dstep.foundation.NSObject; | |
22 import dstep.foundation.NSRange; | |
23 import dstep.objc.bridge.Bridge; | |
24 import dstep.objc.objc; | |
25 | |
26 typedef NSUInteger NSTypesetterControlCharacterAction; | |
27 | |
28 enum : NSUInteger | |
29 { | |
30 NSTypesetterZeroAdvancementAction = (1 << 0), | |
31 NSTypesetterWhitespaceAction = (1 << 1), | |
32 NSTypesetterHorizontalTabAction = (1 << 2), | |
33 NSTypesetterLineBreakAction = (1 << 3), | |
34 NSTypesetterParagraphBreakAction = (1 << 4), | |
35 NSTypesetterContainerBreakAction = (1 << 5) | |
36 } | |
37 | |
38 const TNSLayoutPhaseInterface = ` | |
39 | |
40 void willSetLineFragmentRect (NSRectPointer lineRect, NSRange glyphRange, NSRectPointer usedRect, CGFloat* baselineOffset) | |
41 { | |
42 return invokeObjcSelf!(void, "willSetLineFragmentRect:forGlyphRange:usedRect:baselineOffset:", NSRectPointer, NSRange, NSRectPointer, CGFloat*)(lineRect, glyphRange, usedRect, baselineOffset); | |
43 } | |
44 | |
45 bool shouldBreakLineByWordBeforeCharacterAtIndex (NSUInteger charIndex) | |
46 { | |
47 return invokeObjcSelf!(bool, "shouldBreakLineByWordBeforeCharacterAtIndex:", NSUInteger)(charIndex); | |
48 } | |
49 | |
50 bool shouldBreakLineByHyphenatingBeforeCharacterAtIndex (NSUInteger charIndex) | |
51 { | |
52 return invokeObjcSelf!(bool, "shouldBreakLineByHyphenatingBeforeCharacterAtIndex:", NSUInteger)(charIndex); | |
53 } | |
54 | |
55 float hyphenationFactorForGlyphAtIndex (NSUInteger glyphIndex) | |
56 { | |
57 return invokeObjcSelf!(float, "hyphenationFactorForGlyphAtIndex:", NSUInteger)(glyphIndex); | |
58 } | |
59 | |
60 uint hyphenCharacterForGlyphAtIndex (NSUInteger glyphIndex) | |
61 { | |
62 return invokeObjcSelf!(uint, "hyphenCharacterForGlyphAtIndex:", NSUInteger)(glyphIndex); | |
63 } | |
64 | |
65 NSRect boundingBoxForControlGlyphAtIndex (NSUInteger glyphIndex, NSTextContainer textContainer, NSRect proposedRect, NSPoint glyphPosition, NSUInteger charIndex) | |
66 { | |
67 return invokeObjcSelf!(NSRect, "boundingBoxForControlGlyphAtIndex:forTextContainer:proposedLineFragment:glyphPosition:characterIndex:", NSUInteger, NSTextContainer, NSRect, NSPoint, NSUInteger)(glyphIndex, textContainer, proposedRect, glyphPosition, charIndex); | |
68 } | |
69 | |
70 //mixin ObjcBindMethod!(willSetLineFragmentRect, "willSetLineFragmentRect:forGlyphRange:usedRect:baselineOffset:"); | |
71 //mixin ObjcBindMethod!(shouldBreakLineByWordBeforeCharacterAtIndex, "shouldBreakLineByWordBeforeCharacterAtIndex:"); | |
72 //mixin ObjcBindMethod!(shouldBreakLineByHyphenatingBeforeCharacterAtIndex, "shouldBreakLineByHyphenatingBeforeCharacterAtIndex:"); | |
73 //mixin ObjcBindMethod!(hyphenationFactorForGlyphAtIndex, "hyphenationFactorForGlyphAtIndex:"); | |
74 //mixin ObjcBindMethod!(hyphenCharacterForGlyphAtIndex, "hyphenCharacterForGlyphAtIndex:"); | |
75 //mixin ObjcBindMethod!(boundingBoxForControlGlyphAtIndex, "boundingBoxForControlGlyphAtIndex:forTextContainer:proposedLineFragment:glyphPosition:characterIndex:"); | |
76 | |
77 `; | |
78 | |
79 const TNSGlyphStorageInterface = ` | |
80 | |
81 NSRange characterRangeForGlyphRange (NSRange glyphRange, NSRangePointer actualGlyphRange) | |
82 { | |
83 return invokeObjcSelf!(NSRange, "characterRangeForGlyphRange:actualGlyphRange:", NSRange, NSRangePointer)(glyphRange, actualGlyphRange); | |
84 } | |
85 | |
86 NSRange glyphRangeForCharacterRange (NSRange charRange, NSRangePointer actualCharRange) | |
87 { | |
88 return invokeObjcSelf!(NSRange, "glyphRangeForCharacterRange:actualCharacterRange:", NSRange, NSRangePointer)(charRange, actualCharRange); | |
89 } | |
90 | |
91 NSUInteger getGlyphsInRange (NSRange glyphsRange, NSGlyph* glyphBuffer, NSUInteger* charIndexBuffer, NSGlyphInscription* inscribeBuffer, bool* elasticBuffer, char* bidiLevelBuffer) | |
92 { | |
93 return invokeObjcSelf!(NSUInteger, "getGlyphsInRange:glyphs:characterIndexes:glyphInscriptions:elasticBits:bidiLevels:", NSRange, NSGlyph*, NSUInteger*, NSGlyphInscription*, bool*, char*)(glyphsRange, glyphBuffer, charIndexBuffer, inscribeBuffer, elasticBuffer, bidiLevelBuffer); | |
94 } | |
95 | |
96 void getLineFragmentRect (NSRectPointer lineFragmentRect, NSRectPointer lineFragmentUsedRect, NSRectPointer remainingRect, NSUInteger startingGlyphIndex, NSRect proposedRect, CGFloat lineSpacing, CGFloat paragraphSpacingBefore, CGFloat paragraphSpacingAfter) | |
97 { | |
98 return invokeObjcSelf!(void, "getLineFragmentRect:usedRect:remainingRect:forStartingGlyphAtIndex:proposedRect:lineSpacing:paragraphSpacingBefore:paragraphSpacingAfter:", NSRectPointer, NSRectPointer, NSRectPointer, NSUInteger, NSRect, CGFloat, CGFloat, CGFloat)(lineFragmentRect, lineFragmentUsedRect, remainingRect, startingGlyphIndex, proposedRect, lineSpacing, paragraphSpacingBefore, paragraphSpacingAfter); | |
99 } | |
100 | |
101 void setLineFragmentRect (NSRect fragmentRect, NSRange glyphRange, NSRect usedRect, CGFloat baselineOffset) | |
102 { | |
103 return invokeObjcSelf!(void, "setLineFragmentRect:forGlyphRange:usedRect:baselineOffset:", NSRect, NSRange, NSRect, CGFloat)(fragmentRect, glyphRange, usedRect, baselineOffset); | |
104 } | |
105 | |
106 void substituteGlyphsInRange (NSRange glyphRange, NSGlyph* glyphs) | |
107 { | |
108 return invokeObjcSelf!(void, "substituteGlyphsInRange:withGlyphs:", NSRange, NSGlyph*)(glyphRange, glyphs); | |
109 } | |
110 | |
111 void insertGlyph (uint glyph, NSUInteger glyphIndex, NSUInteger characterIndex) | |
112 { | |
113 return invokeObjcSelf!(void, "insertGlyph:atGlyphIndex:characterIndex:", uint, NSUInteger, NSUInteger)(glyph, glyphIndex, characterIndex); | |
114 } | |
115 | |
116 void deleteGlyphsInRange (NSRange glyphRange) | |
117 { | |
118 return invokeObjcSelf!(void, "deleteGlyphsInRange:", NSRange)(glyphRange); | |
119 } | |
120 | |
121 void setNotShownAttribute (bool flag, NSRange glyphRange) | |
122 { | |
123 return invokeObjcSelf!(void, "setNotShownAttribute:forGlyphRange:", bool, NSRange)(flag, glyphRange); | |
124 } | |
125 | |
126 void setDrawsOutsideLineFragment (bool flag, NSRange glyphRange) | |
127 { | |
128 return invokeObjcSelf!(void, "setDrawsOutsideLineFragment:forGlyphRange:", bool, NSRange)(flag, glyphRange); | |
129 } | |
130 | |
131 void setLocation (NSPoint location, CGFloat* advancements, NSRange glyphRange) | |
132 { | |
133 return invokeObjcSelf!(void, "setLocation:withAdvancements:forStartOfGlyphRange:", NSPoint, CGFloat*, NSRange)(location, advancements, glyphRange); | |
134 } | |
135 | |
136 void setAttachmentSize (NSSize attachmentSize, NSRange glyphRange) | |
137 { | |
138 return invokeObjcSelf!(void, "setAttachmentSize:forGlyphRange:", NSSize, NSRange)(attachmentSize, glyphRange); | |
139 } | |
140 | |
141 void setBidiLevels (char* levels, NSRange glyphRange) | |
142 { | |
143 return invokeObjcSelf!(void, "setBidiLevels:forGlyphRange:", char*, NSRange)(levels, glyphRange); | |
144 } | |
145 | |
146 //mixin ObjcBindMethod!(characterRangeForGlyphRange, "characterRangeForGlyphRange:actualGlyphRange:"); | |
147 //mixin ObjcBindMethod!(glyphRangeForCharacterRange, "glyphRangeForCharacterRange:actualCharacterRange:"); | |
148 //mixin ObjcBindMethod!(getGlyphsInRange, "getGlyphsInRange:glyphs:characterIndexes:glyphInscriptions:elasticBits:bidiLevels:"); | |
149 //mixin ObjcBindMethod!(getLineFragmentRect, "getLineFragmentRect:usedRect:remainingRect:forStartingGlyphAtIndex:proposedRect:lineSpacing:paragraphSpacingBefore:paragraphSpacingAfter:"); | |
150 //mixin ObjcBindMethod!(setLineFragmentRect, "setLineFragmentRect:forGlyphRange:usedRect:baselineOffset:"); | |
151 //mixin ObjcBindMethod!(substituteGlyphsInRange, "substituteGlyphsInRange:withGlyphs:"); | |
152 //mixin ObjcBindMethod!(insertGlyph, "insertGlyph:atGlyphIndex:characterIndex:"); | |
153 //mixin ObjcBindMethod!(deleteGlyphsInRange, "deleteGlyphsInRange:"); | |
154 //mixin ObjcBindMethod!(setNotShownAttribute, "setNotShownAttribute:forGlyphRange:"); | |
155 //mixin ObjcBindMethod!(setDrawsOutsideLineFragment, "setDrawsOutsideLineFragment:forGlyphRange:"); | |
156 //mixin ObjcBindMethod!(setLocation, "setLocation:withAdvancements:forStartOfGlyphRange:"); | |
157 //mixin ObjcBindMethod!(setAttachmentSize, "setAttachmentSize:forGlyphRange:"); | |
158 //mixin ObjcBindMethod!(setBidiLevels, "setBidiLevels:forGlyphRange:"); | |
159 | |
160 `; | |
161 | |
162 class NSTypesetter : NSObject | |
163 { | |
164 mixin (ObjcWrap); | |
165 | |
166 void getLineFragmentRect (NSRectPointer lineFragmentRect, NSRectPointer lineFragmentUsedRect, NSRange paragraphSeparatorGlyphRange, NSPoint lineOrigin) | |
167 { | |
168 return invokeObjcSelf!(void, "getLineFragmentRect:usedRect:forParagraphSeparatorGlyphRange:atProposedOrigin:", NSRectPointer, NSRectPointer, NSRange, NSPoint)(lineFragmentRect, lineFragmentUsedRect, paragraphSeparatorGlyphRange, lineOrigin); | |
169 } | |
170 | |
171 bool usesFontLeading () | |
172 { | |
173 return invokeObjcSelf!(bool, "usesFontLeading"); | |
174 } | |
175 | |
176 void setUsesFontLeading (bool flag) | |
177 { | |
178 return invokeObjcSelf!(void, "setUsesFontLeading:", bool)(flag); | |
179 } | |
180 | |
181 int typesetterBehavior () | |
182 { | |
183 return invokeObjcSelf!(int, "typesetterBehavior"); | |
184 } | |
185 | |
186 void setTypesetterBehavior (int behavior) | |
187 { | |
188 return invokeObjcSelf!(void, "setTypesetterBehavior:", int)(behavior); | |
189 } | |
190 | |
191 float hyphenationFactor () | |
192 { | |
193 return invokeObjcSelf!(float, "hyphenationFactor"); | |
194 } | |
195 | |
196 void setHyphenationFactor (float factor) | |
197 { | |
198 return invokeObjcSelf!(void, "setHyphenationFactor:", float)(factor); | |
199 } | |
200 | |
201 CGFloat lineFragmentPadding () | |
202 { | |
203 return invokeObjcSelf!(CGFloat, "lineFragmentPadding"); | |
204 } | |
205 | |
206 void setLineFragmentPadding (CGFloat padding) | |
207 { | |
208 return invokeObjcSelf!(void, "setLineFragmentPadding:", CGFloat)(padding); | |
209 } | |
210 | |
211 NSFont substituteFontForFont (NSFont originalFont) | |
212 { | |
213 return invokeObjcSelf!(NSFont, "substituteFontForFont:", NSFont)(originalFont); | |
214 } | |
215 | |
216 NSTextTab textTabForGlyphLocation (CGFloat glyphLocation, int direction, CGFloat maxLocation) | |
217 { | |
218 return invokeObjcSelf!(NSTextTab, "textTabForGlyphLocation:writingDirection:maxLocation:", CGFloat, int, CGFloat)(glyphLocation, direction, maxLocation); | |
219 } | |
220 | |
221 bool bidiProcessingEnabled () | |
222 { | |
223 return invokeObjcSelf!(bool, "bidiProcessingEnabled"); | |
224 } | |
225 | |
226 void setBidiProcessingEnabled (bool flag) | |
227 { | |
228 return invokeObjcSelf!(void, "setBidiProcessingEnabled:", bool)(flag); | |
229 } | |
230 | |
231 void setAttributedString (NSAttributedString attrString) | |
232 { | |
233 return invokeObjcSelf!(void, "setAttributedString:", NSAttributedString)(attrString); | |
234 } | |
235 | |
236 NSAttributedString attributedString () | |
237 { | |
238 return invokeObjcSelf!(NSAttributedString, "attributedString"); | |
239 } | |
240 | |
241 void setParagraphGlyphRange (NSRange paragraphRange, NSRange paragraphSeparatorRange) | |
242 { | |
243 return invokeObjcSelf!(void, "setParagraphGlyphRange:separatorGlyphRange:", NSRange, NSRange)(paragraphRange, paragraphSeparatorRange); | |
244 } | |
245 | |
246 NSRange paragraphGlyphRange () | |
247 { | |
248 return invokeObjcSelf!(NSRange, "paragraphGlyphRange"); | |
249 } | |
250 | |
251 NSRange paragraphSeparatorGlyphRange () | |
252 { | |
253 return invokeObjcSelf!(NSRange, "paragraphSeparatorGlyphRange"); | |
254 } | |
255 | |
256 NSRange paragraphCharacterRange () | |
257 { | |
258 return invokeObjcSelf!(NSRange, "paragraphCharacterRange"); | |
259 } | |
260 | |
261 NSRange paragraphSeparatorCharacterRange () | |
262 { | |
263 return invokeObjcSelf!(NSRange, "paragraphSeparatorCharacterRange"); | |
264 } | |
265 | |
266 NSUInteger layoutParagraphAtPoint (NSPointPointer lineFragmentOrigin) | |
267 { | |
268 return invokeObjcSelf!(NSUInteger, "layoutParagraphAtPoint:", NSPointPointer)(lineFragmentOrigin); | |
269 } | |
270 | |
271 void beginParagraph () | |
272 { | |
273 return invokeObjcSelf!(void, "beginParagraph"); | |
274 } | |
275 | |
276 void endParagraph () | |
277 { | |
278 return invokeObjcSelf!(void, "endParagraph"); | |
279 } | |
280 | |
281 void beginLineWithGlyphAtIndex (NSUInteger glyphIndex) | |
282 { | |
283 return invokeObjcSelf!(void, "beginLineWithGlyphAtIndex:", NSUInteger)(glyphIndex); | |
284 } | |
285 | |
286 void endLineWithGlyphRange (NSRange lineGlyphRange) | |
287 { | |
288 return invokeObjcSelf!(void, "endLineWithGlyphRange:", NSRange)(lineGlyphRange); | |
289 } | |
290 | |
291 CGFloat lineSpacingAfterGlyphAtIndex (NSUInteger glyphIndex, NSRect rect) | |
292 { | |
293 return invokeObjcSelf!(CGFloat, "lineSpacingAfterGlyphAtIndex:withProposedLineFragmentRect:", NSUInteger, NSRect)(glyphIndex, rect); | |
294 } | |
295 | |
296 CGFloat paragraphSpacingBeforeGlyphAtIndex (NSUInteger glyphIndex, NSRect rect) | |
297 { | |
298 return invokeObjcSelf!(CGFloat, "paragraphSpacingBeforeGlyphAtIndex:withProposedLineFragmentRect:", NSUInteger, NSRect)(glyphIndex, rect); | |
299 } | |
300 | |
301 CGFloat paragraphSpacingAfterGlyphAtIndex (NSUInteger glyphIndex, NSRect rect) | |
302 { | |
303 return invokeObjcSelf!(CGFloat, "paragraphSpacingAfterGlyphAtIndex:withProposedLineFragmentRect:", NSUInteger, NSRect)(glyphIndex, rect); | |
304 } | |
305 | |
306 NSDictionary attributesForExtraLineFragment () | |
307 { | |
308 return invokeObjcSelf!(NSDictionary, "attributesForExtraLineFragment"); | |
309 } | |
310 | |
311 uint actionForControlCharacterAtIndex (NSUInteger charIndex) | |
312 { | |
313 return invokeObjcSelf!(uint, "actionForControlCharacterAtIndex:", NSUInteger)(charIndex); | |
314 } | |
315 | |
316 NSLayoutManager layoutManager () | |
317 { | |
318 return invokeObjcSelf!(NSLayoutManager, "layoutManager"); | |
319 } | |
320 | |
321 NSArray textContainers () | |
322 { | |
323 return invokeObjcSelf!(NSArray, "textContainers"); | |
324 } | |
325 | |
326 NSTextContainer currentTextContainer () | |
327 { | |
328 return invokeObjcSelf!(NSTextContainer, "currentTextContainer"); | |
329 } | |
330 | |
331 NSParagraphStyle currentParagraphStyle () | |
332 { | |
333 return invokeObjcSelf!(NSParagraphStyle, "currentParagraphStyle"); | |
334 } | |
335 | |
336 void setHardInvalidation (bool flag, NSRange glyphRange) | |
337 { | |
338 return invokeObjcSelf!(void, "setHardInvalidation:forGlyphRange:", bool, NSRange)(flag, glyphRange); | |
339 } | |
340 | |
341 void layoutGlyphsInLayoutManager (NSLayoutManager layoutManager, NSUInteger startGlyphIndex, NSUInteger maxNumLines, NSUInteger* nextGlyph) | |
342 { | |
343 return invokeObjcSelf!(void, "layoutGlyphsInLayoutManager:startingAtGlyphIndex:maxNumberOfLineFragments:nextGlyphIndex:", NSLayoutManager, NSUInteger, NSUInteger, NSUInteger*)(layoutManager, startGlyphIndex, maxNumLines, nextGlyph); | |
344 } | |
345 | |
346 NSRange layoutCharactersInRange (NSRange characterRange, NSLayoutManager layoutManager, NSUInteger maxNumLines) | |
347 { | |
348 return invokeObjcSelf!(NSRange, "layoutCharactersInRange:forLayoutManager:maximumNumberOfLineFragments:", NSRange, NSLayoutManager, NSUInteger)(characterRange, layoutManager, maxNumLines); | |
349 } | |
350 | |
351 static NSSize printingAdjustmentInLayoutManager (NSLayoutManager layoutMgr, NSRange nominallySpacedGlyphsRange, char* packedGlyphs, NSUInteger packedGlyphsCount) | |
352 { | |
353 return invokeObjcSelfClass!(NSSize, "printingAdjustmentInLayoutManager:forNominallySpacedGlyphRange:packedGlyphs:count:", NSLayoutManager, NSRange, char*, NSUInteger)(layoutMgr, nominallySpacedGlyphsRange, packedGlyphs, packedGlyphsCount); | |
354 } | |
355 | |
356 CGFloat baselineOffsetInLayoutManager (NSLayoutManager layoutMgr, NSUInteger glyphIndex) | |
357 { | |
358 return invokeObjcSelf!(CGFloat, "baselineOffsetInLayoutManager:glyphIndex:", NSLayoutManager, NSUInteger)(layoutMgr, glyphIndex); | |
359 } | |
360 | |
361 static Object sharedSystemTypesetter () | |
362 { | |
363 return invokeObjcSelfClass!(Object, "sharedSystemTypesetter"); | |
364 } | |
365 | |
366 static Object sharedSystemTypesetterForBehavior (int theBehavior) | |
367 { | |
368 return invokeObjcSelfClass!(Object, "sharedSystemTypesetterForBehavior:", int)(theBehavior); | |
369 } | |
370 | |
371 static int defaultTypesetterBehavior () | |
372 { | |
373 return invokeObjcSelfClass!(int, "defaultTypesetterBehavior"); | |
374 } | |
375 | |
376 // NSLayoutPhaseInterface | |
377 void willSetLineFragmentRect (NSRectPointer lineRect, NSRange glyphRange, NSRectPointer usedRect, CGFloat* baselineOffset) | |
378 { | |
379 return invokeObjcSelf!(void, "willSetLineFragmentRect:forGlyphRange:usedRect:baselineOffset:", NSRectPointer, NSRange, NSRectPointer, CGFloat*)(lineRect, glyphRange, usedRect, baselineOffset); | |
380 } | |
381 | |
382 bool shouldBreakLineByWordBeforeCharacterAtIndex (NSUInteger charIndex) | |
383 { | |
384 return invokeObjcSelf!(bool, "shouldBreakLineByWordBeforeCharacterAtIndex:", NSUInteger)(charIndex); | |
385 } | |
386 | |
387 bool shouldBreakLineByHyphenatingBeforeCharacterAtIndex (NSUInteger charIndex) | |
388 { | |
389 return invokeObjcSelf!(bool, "shouldBreakLineByHyphenatingBeforeCharacterAtIndex:", NSUInteger)(charIndex); | |
390 } | |
391 | |
392 float hyphenationFactorForGlyphAtIndex (NSUInteger glyphIndex) | |
393 { | |
394 return invokeObjcSelf!(float, "hyphenationFactorForGlyphAtIndex:", NSUInteger)(glyphIndex); | |
395 } | |
396 | |
397 uint hyphenCharacterForGlyphAtIndex (NSUInteger glyphIndex) | |
398 { | |
399 return invokeObjcSelf!(uint, "hyphenCharacterForGlyphAtIndex:", NSUInteger)(glyphIndex); | |
400 } | |
401 | |
402 NSRect boundingBoxForControlGlyphAtIndex (NSUInteger glyphIndex, NSTextContainer textContainer, NSRect proposedRect, NSPoint glyphPosition, NSUInteger charIndex) | |
403 { | |
404 return invokeObjcSelf!(NSRect, "boundingBoxForControlGlyphAtIndex:forTextContainer:proposedLineFragment:glyphPosition:characterIndex:", NSUInteger, NSTextContainer, NSRect, NSPoint, NSUInteger)(glyphIndex, textContainer, proposedRect, glyphPosition, charIndex); | |
405 } | |
406 | |
407 // NSGlyphStorageInterface | |
408 NSRange characterRangeForGlyphRange (NSRange glyphRange, NSRangePointer actualGlyphRange) | |
409 { | |
410 return invokeObjcSelf!(NSRange, "characterRangeForGlyphRange:actualGlyphRange:", NSRange, NSRangePointer)(glyphRange, actualGlyphRange); | |
411 } | |
412 | |
413 NSRange glyphRangeForCharacterRange (NSRange charRange, NSRangePointer actualCharRange) | |
414 { | |
415 return invokeObjcSelf!(NSRange, "glyphRangeForCharacterRange:actualCharacterRange:", NSRange, NSRangePointer)(charRange, actualCharRange); | |
416 } | |
417 | |
418 NSUInteger getGlyphsInRange (NSRange glyphsRange, NSGlyph* glyphBuffer, NSUInteger* charIndexBuffer, NSGlyphInscription* inscribeBuffer, bool* elasticBuffer, char* bidiLevelBuffer) | |
419 { | |
420 return invokeObjcSelf!(NSUInteger, "getGlyphsInRange:glyphs:characterIndexes:glyphInscriptions:elasticBits:bidiLevels:", NSRange, NSGlyph*, NSUInteger*, NSGlyphInscription*, bool*, char*)(glyphsRange, glyphBuffer, charIndexBuffer, inscribeBuffer, elasticBuffer, bidiLevelBuffer); | |
421 } | |
422 | |
423 void getLineFragmentRect (NSRectPointer lineFragmentRect, NSRectPointer lineFragmentUsedRect, NSRectPointer remainingRect, NSUInteger startingGlyphIndex, NSRect proposedRect, CGFloat lineSpacing, CGFloat paragraphSpacingBefore, CGFloat paragraphSpacingAfter) | |
424 { | |
425 return invokeObjcSelf!(void, "getLineFragmentRect:usedRect:remainingRect:forStartingGlyphAtIndex:proposedRect:lineSpacing:paragraphSpacingBefore:paragraphSpacingAfter:", NSRectPointer, NSRectPointer, NSRectPointer, NSUInteger, NSRect, CGFloat, CGFloat, CGFloat)(lineFragmentRect, lineFragmentUsedRect, remainingRect, startingGlyphIndex, proposedRect, lineSpacing, paragraphSpacingBefore, paragraphSpacingAfter); | |
426 } | |
427 | |
428 void setLineFragmentRect (NSRect fragmentRect, NSRange glyphRange, NSRect usedRect, CGFloat baselineOffset) | |
429 { | |
430 return invokeObjcSelf!(void, "setLineFragmentRect:forGlyphRange:usedRect:baselineOffset:", NSRect, NSRange, NSRect, CGFloat)(fragmentRect, glyphRange, usedRect, baselineOffset); | |
431 } | |
432 | |
433 void substituteGlyphsInRange (NSRange glyphRange, NSGlyph* glyphs) | |
434 { | |
435 return invokeObjcSelf!(void, "substituteGlyphsInRange:withGlyphs:", NSRange, NSGlyph*)(glyphRange, glyphs); | |
436 } | |
437 | |
438 void insertGlyph (uint glyph, NSUInteger glyphIndex, NSUInteger characterIndex) | |
439 { | |
440 return invokeObjcSelf!(void, "insertGlyph:atGlyphIndex:characterIndex:", uint, NSUInteger, NSUInteger)(glyph, glyphIndex, characterIndex); | |
441 } | |
442 | |
443 void deleteGlyphsInRange (NSRange glyphRange) | |
444 { | |
445 return invokeObjcSelf!(void, "deleteGlyphsInRange:", NSRange)(glyphRange); | |
446 } | |
447 | |
448 void setNotShownAttribute (bool flag, NSRange glyphRange) | |
449 { | |
450 return invokeObjcSelf!(void, "setNotShownAttribute:forGlyphRange:", bool, NSRange)(flag, glyphRange); | |
451 } | |
452 | |
453 void setDrawsOutsideLineFragment (bool flag, NSRange glyphRange) | |
454 { | |
455 return invokeObjcSelf!(void, "setDrawsOutsideLineFragment:forGlyphRange:", bool, NSRange)(flag, glyphRange); | |
456 } | |
457 | |
458 void setLocation (NSPoint location, CGFloat* advancements, NSRange glyphRange) | |
459 { | |
460 return invokeObjcSelf!(void, "setLocation:withAdvancements:forStartOfGlyphRange:", NSPoint, CGFloat*, NSRange)(location, advancements, glyphRange); | |
461 } | |
462 | |
463 void setAttachmentSize (NSSize attachmentSize, NSRange glyphRange) | |
464 { | |
465 return invokeObjcSelf!(void, "setAttachmentSize:forGlyphRange:", NSSize, NSRange)(attachmentSize, glyphRange); | |
466 } | |
467 | |
468 void setBidiLevels (char* levels, NSRange glyphRange) | |
469 { | |
470 return invokeObjcSelf!(void, "setBidiLevels:forGlyphRange:", char*, NSRange)(levels, glyphRange); | |
471 } | |
472 } |