macOS/iOS API解説

iOS , Mac アプリケーション開発のために使われる主要フレームワークの日本語情報です。2010年代に書かれた内容です。今後更新はありません。

目次

positionOfGlyph:forCharacter:struckOverRect:

指定したグリフが指定した範囲で文字を表す時の位置を返します
-(NSPoint)positionOfGlyph:(NSGlyph)aGlyph:
          forCharacter:(unichar)aChar:
          struckOverRect:(NSRect)aRect:

解説

指定したグリフ(aGluph)が指定した範囲(aRect)で文字(aChar)を表す時の位置を返します。
Mac OS X v10.4以降使えません。

返り値

( NSPoint )

グリフの位置

引数

( NSGlyph )aGlyph

グリフ

( unichar )aChar

文字

( NSRect )aRect

範囲

フレームワーク

ApplicationKit

クラス

NSFont

Instance Methods

使用可能

10.0

参照

例文

#import "MyObject.h"

@implementation MyObject

- (IBAction)myAction:(id)sender
{
NSFont *fnt;
unichar chr = 'A';
fnt = [NSFont fontWithName:@"Osaka" size:36] ;


NSLog([NSString stringWithFormat:@"%f",[fnt positionOfGlyph:(NSGlyph)'A' 
                        forCharacter:chr
                        struckOverRect:NSMakeRect(2,2,10,10)
                        ].x]);
}

@end