macOS/iOS API解説

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

目次

textTransform

レシーバーの変換マトリックスを返します

解説

レシーバーの変換マトリックスを返します。

返り値

( NSAffineTransform * )

なし

引数

フレームワーク

ApplicationKit

クラス

NSFont

Instance Methods

使用可能

10.4

参照

+useFont:
-set

例文

#import "MyView.h"

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

-(void)drawRect:(NSRect)rect
{
	NSFont *font = [NSFont fontWithName:@"Osaka" size:100.0];
	
	
	NSBezierPath *thePath = [NSBezierPath bezierPath];
	NSGlyph glyphID[8];
			glyphID[0]=70;
			glyphID[1]=99;
			glyphID[2]=106;
			glyphID[3]=106;
			glyphID[4]=109;
			glyphID[5]=2284;
			glyphID[6]=1064;
			glyphID[7]=262;

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


			[[NSColor blueColor] set];
			[thePath fill];
			
			NSAffineTransform *affine = [font textTransform];
			NSLog([affine description]);
			NSPoint newPoint = [affine transformPoint: NSMakePoint(20,20)];
			NSLog(@"x:%.1f y:%.1f",newPoint.x,newPoint.y);



}

@end