-
Notifications
You must be signed in to change notification settings - Fork 56
/
EditPaneLayoutManager.m
54 lines (42 loc) · 1.36 KB
/
EditPaneLayoutManager.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
//
// TCLayoutManager.m
// MarkdownLive
//
// Created by Akihiro Noguchi on 7/05/11.
// Copyright 2011 Aki. All rights reserved.
//
#import "EditPaneLayoutManager.h"
#import "EditPaneTypesetter.h"
@implementation EditPaneLayoutManager
@synthesize font;
- (id)init {
if ((self = [super init])) {
EditPaneTypesetter *typeSetter = [[EditPaneTypesetter alloc] init];
[self setTypesetter:typeSetter];
[self setUsesFontLeading:NO];
}
return self;
}
- (CGFloat)lineHeight {
return floor([self defaultLineHeightForFont:font] + 1.5);
}
- (void)setLineFragmentRect:(NSRect)inFragmentRect forGlyphRange:(NSRange)inGlyphRange
usedRect:(NSRect)inUsedRect {
inFragmentRect.size.height = [self lineHeight];
inUsedRect.size.height = [self lineHeight];
(void)[super setLineFragmentRect:(NSRect)inFragmentRect
forGlyphRange:(NSRange)inGlyphRange
usedRect:(NSRect)inUsedRect];
}
- (void)setExtraLineFragmentRect:(NSRect)inFragmentRect usedRect:(NSRect)inUsedRect
textContainer:(NSTextContainer *)inTextContainer {
inFragmentRect.size.height = [self lineHeight];
[super setExtraLineFragmentRect:inFragmentRect usedRect:inUsedRect
textContainer:inTextContainer];
}
- (NSPoint)locationForGlyphAtIndex:(NSUInteger)inGlyphIndex {
NSPoint outPoint = [super locationForGlyphAtIndex:inGlyphIndex];
outPoint.y = [font pointSize];
return outPoint;
}
@end