Archived
1
This repository has been archived on 2022-08-08. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
mathpad/MathPad/MPSumFunctionLayout.m
Kim Wittenburg 60760b8b3d Internal Redesign:
- Combined MPExpression and MPMutableExpression
- Abstracted children of MPExpression into MPExpressionElement protocol
- Abstracted most of MPExpressionLayout and MPFunctionLayout into common superclass MPLayout
2014-08-11 13:57:48 +02:00

37 lines
1.2 KiB
Objective-C

//
// 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