bug-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug #21696] [NSText sizeToFit] resizes only to include the first charac


From: Christopher Wojno
Subject: [bug #21696] [NSText sizeToFit] resizes only to include the first character
Date: Sun, 02 Dec 2007 03:08:10 +0000
User-agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.8.1.9) Gecko/20071117 Firefox/2.0.0.9

URL:
  <http://savannah.gnu.org/bugs/?21696>

                 Summary: [NSText sizeToFit] resizes only to include the
first character
                 Project: GNUstep
            Submitted by: wojno
            Submitted on: Sunday 12/02/2007 at 03:08
                Category: Gui/AppKit
                Severity: 3 - Normal
              Item Group: Bug
                  Status: None
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Any

    _______________________________________________________

Details:

Similar to bug #21695, however, while I claimed Horizontal worked, it changed
the size only such that the first character in the string sent to the NSText
by setString is sized. The remainder of the string is clipped.

NSText *text;
text = [[NSText alloc] initWithFrame:NSMakeRect(0,0,1,15)];
[text setHorizontallyResizable:YES];
[text setVerticallyResizable:NO]; // fails with this YES or NO
[text setFont:[NSFont fontWithName:@"Helvetica" size:10]];
[text setString: @"Menu"];
[text sizeToFit];
NSRect bad = [text frame];

Result:
12 = bad.size.width

One may think that a work-around would be to manually set the frame after
multiplying it. This is not the case: Twelve pixes is APPROXIMATELY 1/4th the
size as the string is 4 characters. But that is only an estimation and exact
only with Monospaced fonts. Additionally, attempts to set the width AFTER a
sizeToFit call have not effect.

Summary:
 * Resized incorrectly (wrong width)
 * Cannot manually set width later (by design?)




    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?21696>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/





reply via email to

[Prev in Thread] Current Thread [Next in Thread]