| Home 目次>ApplicationKit>NSFont | 10.4 |
getBoundingRects:forGlyphs:count:
バウンディング矩形を返します
-(void) getBoundingRects:(NSRectArray)bounds
forGlyphs:(const NSGlyph *)glyphs
count:(unsigned)glyphCount
【返り値】 | |
| void | なし |
| 【パラメータ】 | |
| bounds | |
| glyphs | |
| glyphCount |
【解説】
バウンディング矩形を返します。
【例文】
#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];
NSRect rectArray[ 2 ];
[font getBoundingRects:&rectArray[ 0 ] forGlyphs:&glyphID[ 0 ] count: 2 ];
NSLog( @"%f,%f" ,rectArray[ 0 ].origin.x,rectArray[ 1 ].origin.x);
NSLog( @"%f,%f" ,rectArray[ 0 ].origin.y,rectArray[ 1 ].origin.y);
NSLog( @"%f,%f" ,rectArray[ 0 ].size.width,rectArray[ 1 ].size.width);
NSLog( @"%f,%f" ,rectArray[ 0 ].size.height,rectArray[ 1 ].size.height);
}
@end
![]() | |
この記事を評価してください。
| Home 目次>ApplicationKit>NSFont | 修正日2007.4.10 |