Is this a bug in NSTextField?
Is this a bug in NSTextField?
- Subject: Is this a bug in NSTextField?
- From: "Chen Wang" <email@hidden>
- Date: Wed, 9 Jan 2008 17:04:57 -0500
- Thread-topic: Is this a bug in NSTextField?
Dear List,
I recently created a NSAttributedString with NSObliquenessAttributeName
applied to the *entire* string, and NSStrokeWidthAttributeName applied
to *part* of the string. When I passed this string to [NSTextField
setAttributedStringValue:], I supposed that all characters shown in the
NSTextField should have identical obliqueness angle, but what I actually
saw was that the obliqueness angle kept increasing across the entire
text field from left to right. The reason for thinking this as a bug is
that if I add a '\n' at the end of the string, everything becomes OK --
the entire text shows consistent obliqueness angle. So, before firing a
bug, it's better to be confirmed here.
Thanks,
Chen
== Below is the code fragment causing the problem
=========================================
// create sample attributed string
NSMutableAttributedString *testString = [[NSMutableAttributedString
alloc] initWithString: @"We were going to go home."];
if ( nil != testString )
{
// Create text attributes
NSMutableDictionary *testAttributes = [NSMutableDictionary
dictionaryWithCapacity: 3];
[testAttributes setObject: [NSFont systemFontOfSize:24.0] forKey:
NSFontAttributeName];
[testAttributes setObject: [NSNumber numberWithFloat:0.3] forKey:
@"NSObliqueness"];
// Apply sttributes to sample string
[testString setAttributes: testAttributes range: NSMakeRange(0,
[testString length])];
// Add stroke width into attributes
[testAttributes setObject: [NSNumber numberWithFloat:-5.0] forKey:
@"NSStrokeWidth"];
// Apply the modified attributes to part of the sample string (in this
case, the word "were")
[testString setAttributes: testAttributes range: NSMakeRange(3, 4)];
// Show sample string
[IB_TextField setAttributedStringValue: testString];
[testString release];
testString = nil;
}
Confidentiality Notice: E-mail may be intercepted between the sender and the receiver and is therefore neither secure nor confidential. Your continued use of e-mail communication confirms that you accept this risk. If this is an urgent matter, please contact me at the phone number provided. This e-mail, including any attachments, is for the sole use of the intended recipient(s) and may contain private, confidential, and privileged information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient or this information has been inappropriately forwarded to you, please contact the sender by reply e-mail and destroy all copies of the original
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden