Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 60 lines (47 sloc) 1.476 kB
5187b09 @aki-null Added font preference. Removed rich text related menu items. Implemen…
aki-null authored
1 //
2 // TCLayoutManager.m
3 // MarkdownLive
4 //
5 // Created by Akihiro Noguchi on 7/05/11.
6 // Copyright 2011 Aki. All rights reserved.
7 //
8
9 #import "EditPaneLayoutManager.h"
10 #import "EditPaneTypesetter.h"
11
12
13 @implementation EditPaneLayoutManager
14
15 @synthesize font;
16
17 - (id)init {
18 if ((self = [super init])) {
19 EditPaneTypesetter *typeSetter = [[EditPaneTypesetter alloc] init];
20 [self setTypesetter:typeSetter];
21 [typeSetter release];
22 [self setUsesFontLeading:NO];
23 }
24 return self;
25 }
26
27 - (void)dealloc {
28 self.font = nil;
29 [super dealloc];
30 }
31
32 - (CGFloat)lineHeight {
33 return floor([self defaultLineHeightForFont:font] + 1.5);
34 }
35
36 - (void)setLineFragmentRect:(NSRect)inFragmentRect forGlyphRange:(NSRange)inGlyphRange
37 usedRect:(NSRect)inUsedRect {
38 inFragmentRect.size.height = [self lineHeight];
39 inUsedRect.size.height = [self lineHeight];
40
41 (void)[super setLineFragmentRect:(NSRect)inFragmentRect
42 forGlyphRange:(NSRange)inGlyphRange
43 usedRect:(NSRect)inUsedRect];
44 }
45
46 - (void)setExtraLineFragmentRect:(NSRect)inFragmentRect usedRect:(NSRect)inUsedRect
47 textContainer:(NSTextContainer *)inTextContainer {
48 inFragmentRect.size.height = [self lineHeight];
49 [super setExtraLineFragmentRect:inFragmentRect usedRect:inUsedRect
50 textContainer:inTextContainer];
51 }
52
53 - (NSPoint)locationForGlyphAtIndex:(NSUInteger)inGlyphIndex {
54 NSPoint outPoint = [super locationForGlyphAtIndex:inGlyphIndex];
55 outPoint.y = [font pointSize];
56 return outPoint;
57 }
58
59 @end
Something went wrong with that request. Please try again.