Skip to content

Commit 75914d6

Browse files
committed
Update for OS X 10.10
1 parent 1571153 commit 75914d6

File tree

3 files changed

+12
-24
lines changed

3 files changed

+12
-24
lines changed

AppController.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ + (void)initialize {
5252

5353
[appDefaults setValue:@"#000000" forKey:@"foregroundColor"];
5454
[appDefaults setValue:@"#FFFFFF" forKey:@"backgroundColor"];
55-
[appDefaults setValue:@"STKaiti" forKey:@"fontName"];
55+
[appDefaults setValue:@"STKaiti-SC-Regular" forKey:@"fontName"];
5656
[appDefaults setValue:@24.0 forKey:@"fontSize"];
5757
[appDefaults setValue:@1.1 forKey:@"lineHeight"];
5858
[appDefaults setValue:[NSMutableDictionary dictionaryWithCapacity:20]

TTDocument.m

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ - (void)close {
7575
}
7676

7777
- (void)dealloc {
78-
7978
NSArray* keyPaths =
8079
@[ @"backgroundColor", @"lineHeight", @"fontName", @"fontSize" ];
8180
NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults];
@@ -115,15 +114,10 @@ - (NSData*)dataOfType:(NSString*)typeName error:(NSError**)outError {
115114

116115
- (NSDictionary*)attributesForText {
117116
NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults];
118-
NSDictionary* descriptorAttributes =
119-
@{(NSString*)kCTFontNameAttribute : [defaults stringForKey:@"fontName"]};
120-
CTFontDescriptorRef cjkDescriptor = CTFontDescriptorCreateWithAttributes(
121-
(CFDictionaryRef)descriptorAttributes);
122-
123-
CTFontDescriptorRef descriptor = cjkDescriptor;
124-
CTFontRef font = CTFontCreateWithFontDescriptor(
125-
descriptor, [defaults doubleForKey:@"fontSize"], NULL);
126-
CFRelease(descriptor);
117+
CTFontRef font =
118+
CTFontCreateWithName((CFStringRef)[defaults stringForKey:@"fontName"],
119+
[defaults doubleForKey:@"fontSize"],
120+
NULL);
127121
NSDictionary* attributes =
128122
@{(NSString*)kCTFontAttributeName : CFBridgingRelease(font)};
129123
return attributes;
@@ -239,15 +233,12 @@ - (BOOL)readFromURL:(NSURL*)absoluteURL
239233
NSRange tokenRange,
240234
NSRange sentenceRange,
241235
BOOL* stop) {
242-
if ([tag isEqualToString:@"Latn"]) {
243-
NSString* token =
244-
[tagger.string substringWithRange:tokenRange];
245-
NSLog(@"%@", token);
246-
[fileContents
247-
addAttribute:(NSString*)kCTFontAttributeName
248-
value:latinFont
249-
range:tokenRange];
250-
}
236+
if (![tag hasPrefix:@"Han"]) {
237+
[fileContents
238+
addAttribute:(NSString*)kCTFontAttributeName
239+
value:latinFont
240+
range:tokenRange];
241+
}
251242
}];
252243
}
253244

TTTextView.mm

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,13 +99,10 @@ - (void)invalidateLayout {
9999
[[NSUserDefaults standardUserDefaults] doubleForKey:@"lineHeight"];
100100
_lineHeight = ceil(_lineHeight);
101101

102-
CGFloat scrollerWidth = [NSScroller isCompatibleWithOverlayScrollers]
103-
? 0
104-
: [NSScroller scrollerWidth];
105102
CGRect frameRect =
106103
CGRectMake(textInset.width,
107104
textInset.height,
108-
contentSize.width - 2 * textInset.width - scrollerWidth,
105+
contentSize.width - 2 * textInset.width,
109106
contentSize.height - textInset.height);
110107

111108
TTLineData lineData = {NULL, CGPointMake(0, 0)};

0 commit comments

Comments
 (0)