Mercurial > dwindows
changeset 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 | 9772a2306b43 |
children | 5f1677cc32e9 |
files | mac/dw.m |
diffstat | 1 files changed, 6 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/mac/dw.m Mon Jan 25 22:09:49 2021 +0000 +++ b/mac/dw.m Tue Jan 26 11:02:43 2021 +0000 @@ -6345,7 +6345,12 @@ unsigned int retval; NSTextStorage *ts = [mle textStorage]; NSString *nstr = [NSString stringWithUTF8String:buffer]; - NSDictionary *attributes = [NSDictionary dictionaryWithObject:NSColor.textColor forKey:NSForegroundColorAttributeName]; + NSColor *fgcolor = [ts foregroundColor]; + NSFont *font = [ts font]; + NSMutableDictionary *attributes = [[NSMutableDictionary alloc] init]; + [attributes setObject:(fgcolor ? fgcolor : NSColor.textColor) forKey:NSForegroundColorAttributeName]; + if(font) + [attributes setObject:font forKey:NSFontAttributeName]; NSAttributedString *nastr = [[NSAttributedString alloc] initWithString:nstr attributes:attributes]; NSUInteger length = [ts length]; if(startpoint < 0)