Mercurial > dwindows
comparison mac/dw.m @ 2258:7cd64f66f1cc
Mac: Need to use the font and color set on the NSTextStorage when creating
the attributes for adding text in dw_mle_import().
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Tue, 26 Jan 2021 11:02:43 +0000 |
parents | 5dbe950115c1 |
children | fe64be23680e |
comparison
equal
deleted
inserted
replaced
2257:9772a2306b43 | 2258:7cd64f66f1cc |
---|---|
6343 DW_FUNCTION_INIT; | 6343 DW_FUNCTION_INIT; |
6344 DWMLE *mle = handle; | 6344 DWMLE *mle = handle; |
6345 unsigned int retval; | 6345 unsigned int retval; |
6346 NSTextStorage *ts = [mle textStorage]; | 6346 NSTextStorage *ts = [mle textStorage]; |
6347 NSString *nstr = [NSString stringWithUTF8String:buffer]; | 6347 NSString *nstr = [NSString stringWithUTF8String:buffer]; |
6348 NSDictionary *attributes = [NSDictionary dictionaryWithObject:NSColor.textColor forKey:NSForegroundColorAttributeName]; | 6348 NSColor *fgcolor = [ts foregroundColor]; |
6349 NSFont *font = [ts font]; | |
6350 NSMutableDictionary *attributes = [[NSMutableDictionary alloc] init]; | |
6351 [attributes setObject:(fgcolor ? fgcolor : NSColor.textColor) forKey:NSForegroundColorAttributeName]; | |
6352 if(font) | |
6353 [attributes setObject:font forKey:NSFontAttributeName]; | |
6349 NSAttributedString *nastr = [[NSAttributedString alloc] initWithString:nstr attributes:attributes]; | 6354 NSAttributedString *nastr = [[NSAttributedString alloc] initWithString:nstr attributes:attributes]; |
6350 NSUInteger length = [ts length]; | 6355 NSUInteger length = [ts length]; |
6351 if(startpoint < 0) | 6356 if(startpoint < 0) |
6352 startpoint = 0; | 6357 startpoint = 0; |
6353 if(startpoint > length) | 6358 if(startpoint > length) |