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