macOS/iOS API解説

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

目次

positionOfGlyph:withRelation:toBaseGlyph:totalAdvancement:metricsExist:

グリフの位置を返します
-(NSPoint)positionOfGlyph:(NSGlyph)aGlyph:
          withRelation:(NSGlyphRelation)relation:
          toBaseGlyph:(NSGlyph)baseGlyph:
          totalAdvancement:(NSSizePointer)offset:
          metricsExist:(BOOL *)flag:

解説

グリフの位置を返します。
Mac OS X v10.4以降使えません。
【NSGlyphRelation】
● NSGlyphBelow
● NSGlyphAbove

返り値

( NSPoint )

グリフの位置

引数

( NSGlyph )aGlyph

グリフ

( NSGlyphRelation )relation
( NSGlyph )baseGlyph

ベースグリフ

( NSSizePointer )offset

オフセット

( BOOL * )flag

フォントメトリックスフラグ

フレームワーク

ApplicationKit

クラス

NSFont

Instance Methods

使用可能

10.0

参照

例文

#import "MyObject.h"

@implementation MyObject

- (IBAction)myAction:(id)sender
{
BOOL ret;
NSFont *fnt = [NSFont fontWithName:@"Osaka" size:36] ;
NSSize offset;
NSPoint point = [fnt positionOfGlyph:(NSGlyph)'A'
                                            withRelation:NSGlyphBelow
                                            toBaseGlyph:(NSGlyph)'B'
                                            totalAdvancement:&offset
                                            metricsExist:&ret
                                            ];
                        
NSLog([NSString stringWithFormat:@"%f,%f",point.x,point.x]); 
NSLog([NSString stringWithFormat:@"%f,%f",offset.width,offset.height]);
(ret) ? NSLog(@"YES") : NSLog(@"NO");                     
}

@end