// // MPSumFunctionLayout.m // MathPad // // Created by Kim Wittenburg on 23.04.14. // Copyright (c) 2014 Kim Wittenburg. All rights reserved. // #import "MPSumFunctionLayout.h" #import "MPSumFunction.h" @implementation MPSumFunctionLayout - (MPSumFunction *)sumFunction { return (MPSumFunction *)self.function; } - (NSBezierPath *)generateBezierPath { NSAttributedString *text = [[NSAttributedString alloc] initWithString:@"∑" attributes:@{NSFontAttributeName: [NSFont fontWithName:@"Lucida Grande" size:18.0]}]; self.textStorage.attributedString = text; NSRange glyphRange = [self.layoutManager glyphRangeForTextContainer:self.textContainer]; NSGlyph glyphs[glyphRange.length+1]; NSUInteger actualGylphCount = [self.layoutManager getGlyphs:glyphs range:glyphRange]; NSBezierPath *path = [NSBezierPath bezierPath]; [path moveToPoint:NSZeroPoint]; [path appendBezierPathWithGlyphs:glyphs count:actualGylphCount inFont:[NSFont fontWithName:@"Lucida Grande" size:18.0]]; return path; } @end