Mercurial > dwindows
comparison ios/dw.m @ 2444:ba24ddb19a43
iOS: Fix font and colors on MLE imported text.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Fri, 09 Apr 2021 10:01:22 +0000 |
parents | 42ba334cb8f7 |
children | a773008c7c5d |
comparison
equal
deleted
inserted
replaced
2443:42ba334cb8f7 | 2444:ba24ddb19a43 |
---|---|
4834 DW_FUNCTION_INIT; | 4834 DW_FUNCTION_INIT; |
4835 DWMLE *mle = handle; | 4835 DWMLE *mle = handle; |
4836 unsigned int retval; | 4836 unsigned int retval; |
4837 NSTextStorage *ts = [mle textStorage]; | 4837 NSTextStorage *ts = [mle textStorage]; |
4838 NSString *nstr = [NSString stringWithUTF8String:buffer]; | 4838 NSString *nstr = [NSString stringWithUTF8String:buffer]; |
4839 NSAttributedString *nastr = [[NSAttributedString alloc] initWithString:nstr]; | 4839 UIColor *fgcolor = [mle textColor]; |
4840 UIFont *font = [mle font]; | |
4841 NSMutableDictionary *attributes = [[NSMutableDictionary alloc] init]; | |
4842 [attributes setObject:(fgcolor ? fgcolor : [UIColor labelColor]) forKey:NSForegroundColorAttributeName]; | |
4843 if(font) | |
4844 [attributes setObject:font forKey:NSFontAttributeName]; | |
4845 NSAttributedString *nastr = [[NSAttributedString alloc] initWithString:nstr attributes:attributes]; | |
4840 NSUInteger length = [ts length]; | 4846 NSUInteger length = [ts length]; |
4841 if(startpoint < 0) | 4847 if(startpoint < 0) |
4842 startpoint = 0; | 4848 startpoint = 0; |
4843 if(startpoint > length) | 4849 if(startpoint > length) |
4844 startpoint = (int)length; | 4850 startpoint = (int)length; |