cog/Transformers/FontSizetoLineHeightTransfo...

26 lines
727 B
Matlab
Raw Normal View History

//
// FontSizetoLineHeightTransformer.m
// Cog
//
// Created by Matthew Grinshpun on 18/02/08.
// Copyright 2008 __MyCompanyName__. All rights reserved.
//
#import "FontSizetoLineHeightTransformer.h"
@implementation FontSizetoLineHeightTransformer
+ (Class)transformedValueClass { return [NSNumber class]; }
+ (BOOL)allowsReverseTransformation { return NO; }
// Convert from font size to height in playlist view
- (id)transformedValue:(id)value {
NSFont *font = [NSFont systemFontOfSize:[(NSNumber *)value floatValue]];
NSLayoutManager *layoutManager = [[NSLayoutManager alloc] init];
float fRowSize = [layoutManager defaultLineHeightForFont:font];
return [NSNumber numberWithFloat: fRowSize];
}
@end