macOS/iOS API解説

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

目次

drawPackedGlyphs:atPoint:

INDEX>AppKit>NSBezier

現在のグラフィックコンテキストのシステム座標で文字を描きます

Objective-C

+ (void)drawPackedGlyphs:(const char *)packedGlyphs
                 atPoint:(NSPoint)aPoint

Swift

class func drawPackedGlyphs(_ packedGlyphs: UnsafePointer<Int8>,
                    atPoint aPoint: NSPoint)

解説

現在のグラフィックコンテキストのシステム座標において、aPointでpackedGlyphsで文字を描きます。

返り値

なし

引数

グリフ
Objective-C

(const char *)packedGlyphs

Swift

packedGlyphs: UnsafePointer<Int8>

位置
Objective-C

atPoint:(NSPoint)aPoint

Swift

atPoint aPoint: NSPoint

フレームワーク

ApplicationKit

クラス

NSBezierPath

使用可能

10.0

参照


appendBezierPathWithGlyph:inFont: - Cocoa API解説(iOS/OS X)


appendBezierPathWithGlyphs:count:inFont: - Cocoa API解説(iOS/OS X)


appendBezierPathWithPackedGlyphs: - Cocoa API解説(iOS/OS X)

set (NSColor)

関連記事(外部サイト)

例文

Objective-C

#import "DrawPath.h"

@implementation DrawPath

- (IBAction)draw:(id)sender;
{
NSFont *font =[NSFont fontWithName:@"Osaka" size:36.0];
NSBezierPath *thePath = [NSBezierPath bezierPath];

int ret;
NSGlyph glyph= 4546;
char packedGlyphs;

ret =  NSConvertGlyphsToPackedGlyphs(&glyph, 1, NSNativeShortGlyphPacking, &packedGlyphs);
NSLog([NSString stringWithFormat:@"%d",ret]);
[view lockFocus];
[[NSColor blueColor] set];
[thePath moveToPoint:NSMakePoint(200,200)];
[thePath lineToPoint:NSMakePoint(250,250)];


[thePath appendBezierPathWithGlyph:[font glyphWithName:@"a"]
                            inFont:font
                                ];

[NSBezierPath drawPackedGlyphs:&packedGlyphs atPoint:NSMakePoint(100.0, 100.0)];

[[NSColor redColor] set];
[NSBezierPath drawPackedGlyphs:"bb" atPoint:NSMakePoint(150.0, 150.0)];

[[NSColor blueColor] set];

[thePath stroke];
//[thePath fill];


[view unlockFocus];
}

@end

Swift


    

更新時バージョン

10.10