macOS/iOS API解説

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

目次

getAdvancements:forGlyphs:count:

アドバンスメント幅を返します
-(void)getAdvancements:(NSSizeArray)advancements:
              forGlyphs:(const NSGlyph *)glyphs:
              count:(unsigned)glyphCount:

解説

アドバンスメント幅を返します。

返り値

( void )

なし

引数

( NSSizeArray )advancements
( const NSGlyph * )glyphs
( unsigned )glyphCount

フレームワーク

ApplicationKit

クラス

NSFont

Instance Methods

使用可能

10.4

参照

-boundingRectForFont
-boundingRectForGlyph:
-getAdvancements:forPackedGlyphs:length:
-getBoundingRects:forGlyphs:count:

例文

#import "MyView.h"

//MyViewはNSViewのサブクラス
@implementation MyView

-(void)drawRect:(NSRect)rect
{
	NSFont *font =[NSFont userFontOfSize:180.0];
	NSLog([font fontName]);
	NSBezierPath *thePath = [NSBezierPath bezierPath];
	NSGlyph glyphID[2]={43,72};
			
			[thePath moveToPoint:NSMakePoint(0,0)];
			[thePath appendBezierPathWithGlyphs:&glyphID[0]
										count:2
										inFont:font
											];
			[[NSColor blueColor] set];
			[thePath fill];
			
			NSSize sizaArray[2];
			[font getAdvancements:&sizaArray[0] forGlyphs:&glyphID[0] count:2];
			NSLog(@"%f,%f",sizaArray[0].width,sizaArray[1].width);
			
}

@end