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
  • On Jan 9, 2008, at 2:04 PM, Chen Wang wrote:

    > 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.

    Sounds like a bug from the description.  Please file a Radar,
    preferably with a small test application attached.

    Douglas Davidson
  • Further tests shown that the problem seems to be Tiger specific, on both
    powerPC and Intel. Tests with Leopard and Panther are just fine without
    seeing the problem.

    Chen

    > 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.

    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
previous month january 2008 next month
MTWTFSS
  1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31      
Go to today