@@ -75,7 +75,6 @@ - (void)close {
75
75
}
76
76
77
77
- (void )dealloc {
78
-
79
78
NSArray * keyPaths =
80
79
@[ @" backgroundColor" , @" lineHeight" , @" fontName" , @" fontSize" ];
81
80
NSUserDefaults * defaults = [NSUserDefaults standardUserDefaults ];
@@ -115,15 +114,10 @@ - (NSData*)dataOfType:(NSString*)typeName error:(NSError**)outError {
115
114
116
115
- (NSDictionary *)attributesForText {
117
116
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 );
127
121
NSDictionary * attributes =
128
122
@{(NSString *)kCTFontAttributeName : CFBridgingRelease (font)};
129
123
return attributes;
@@ -239,15 +233,12 @@ - (BOOL)readFromURL:(NSURL*)absoluteURL
239
233
NSRange tokenRange,
240
234
NSRange sentenceRange,
241
235
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
+ }
251
242
}];
252
243
}
253
244
0 commit comments