locationForGlyphAtIndex:
グリフ番号の位置を返します
-(NSPoint)locationForGlyphAtIndex:(unsigned)glyphIndex:
解説
グリフ番号の位置を返します。
返り値
( NSPoint )
位置
引数
( unsigned )glyphIndex
グリフ番号
フレームワーク
ApplicationKit
クラス
NSLayoutManager
Instance Methods
使用可能
10.0
参照
- lineFragmentRectForGlyphAtIndex:effectiveRange:
- lineFragmentUsedRectForGlyphAtIndex:effectiveRange:
例文
#import "MyObject.h" @implementation MyObject - (IBAction)myAction:(id)sender { //myOutletはTextView NSLayoutManager *layM1; NSPoint point; NSTextContainer *textContainer1 = [[NSTextContainer allocWithZone:NULL] initWithContainerSize:NSMakeSize(1.0e6, 1.0e6)]; NSTextContainer *textContainer2 = [[NSTextContainer allocWithZone:NULL] initWithContainerSize:NSMakeSize(1.0e6, 1.0e6)]; layM1 = [myOutlet1 layoutManager]; [layM1 addTextContainer:textContainer1]; [layM1 insertTextContainer:textContainer2 atIndex:1]; point = [layM1 locationForGlyphAtIndex:1]; NSLog([NSString stringWithFormat:@"%.1f,%.1f",point.x,point.y]); } @end