macOS/iOS API解説

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

目次

fontDescriptor

レシーバのフォントデスクリプタを返します

解説

レシーバのフォントデスクリプタを返します。

返り値

( NSFontDescriptor * )

フォントデスクリプタ

引数

フレームワーク

ApplicationKit

クラス

NSFont

Instance Methods

使用可能

10.3

参照

+useFont:
-set

例文

#import "MyView.h"

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

-(void)drawRect:(NSRect)rect
{
	//NSFont *font =[NSFont fontWithName:@"Osaka" size:100.0];				//普通に作る時はこっち
	//NSFont *font =[NSFont fontWithName:@"KozMinPro-Light" size:100.0];	//グリフIDのマッピングがOsakaとは違う
	//NSFont *font =[NSFont fontWithName:@"HiraMinPro-W3" size:100.0];		//グリフIDのマッピングがOsakaとは違う
	NSFontDescriptor *fntDesc = [NSFontDescriptor fontDescriptorWithName:@"Osaka" size:0] ;
	NSFont *font =[NSFont fontWithDescriptor:fntDesc size:100.0];

	NSLog([fntDesc description]);
	NSBezierPath *thePath = [NSBezierPath bezierPath];
	NSGlyph glyphID[8] = {70,99,106,106,109,2284,1064,262 }; 

			[thePath moveToPoint:NSMakePoint(10,10)];
			[thePath appendBezierPathWithGlyphs:&glyphID[0]
										count:8
										inFont:font
											];


			[[NSColor blueColor] set];
			[thePath fill];

}

@end