Problems setting NSTextStorage attributes with symbol fonts
Problems setting NSTextStorage attributes with symbol fonts
- Subject: Problems setting NSTextStorage attributes with symbol fonts
- From: Brock Brandenberg <email@hidden>
- Date: Thu, 05 Sep 2002 02:31:33 -0500
Has anyone had any experience applying attributes with symbol fonts to a
NSTextStorage? I have a bug where attributes containing symbol fonts do not
take when applied to an NSTextStorage instance, but every other normal
character font I have works fine. I'm currently using the default fonts set
with 10.2 (plus whatever Office v.X may have forced upon me), which includes
ZapfDingbats and Webdings which both exhibit the problem. I've perused the
docs from NSAttributedString on up through even the NSLayoutManager, but
can't find any settings that would have a negative influence on these fonts.
I thought the control character and invisible character settings of the
NSLayoutManager might have had some underhanded affect on the attached
NSTextStorage, but altering the settings has no affect.
The architecture is a custom object with instances of an NSLayoutManager,
NSTextStorage and NSTextContainer to do glyph layout which I then draw
elsewhere using various methods. Here's a relevant snippet where the
attributes are being applied and logged to verify the problem. Again, when
using normal character fonts, the "myAttributes" object and the attributes
retrieved from the NSTextStorage match, but with the symbol fonts, the
"myAttributes" object is correct but the retrieved attributes aren't. They
get set to the system font LucidaGrande.
NSRange theRange;
if( [myAttributes objectForKey:NSFontAttributeName] )
[myAttributes removeObjectForKey:NSFontAttributeName];
[textStorage beginEditing];
[myAttributes setObject:font forKey:NSFontAttributeName];
[textStorage setAttributes:myAttributes range:NSMakeRange(0,[textStorage
length])];
[textStorage endEditing];
theRange = NSMakeRange(0,[textStorage length]);
NSLog(@"myAttributes: %@", myAttributes);
NSLog(@"textStorage attributes (%@): %@",NSStringFromRange(theRange),
[textStorage attributesAtIndex:0 effectiveRange:&theRange]);
Thanks,
Brock Brandenberg
----- industrial design @ www.bergdesign.com ------
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.