Thank you Andreas for pinning this down. Sadly your solution cannot be used directly. That way all text views or text cell would result in a height of zero. The returned size here has to include at least the height of a new line. This gets handled in the class GSLayoutManager (around line 2600) by adding the extra used rectangle to the returned rectangle.
If you still got time to look further it would help to know, how big the extra_used_rect is in your case and where these values come from. Maybe we fail to initialise the value correctly? That value should get set by the class GSHorizontalTypesetter (line 555). If the wrong value comes from there then the current font is to blame. Could you please inspect that? Again thank you very much! Fred > Am 08.05.2020 um 22:53 schrieb Andreas Höschler via Discussion list for the > GNUstep programming environment <[email protected]>: > > It seems [NSAttributedString size] has a problem!? > > > I did the following: > > - (NSSize) size > { > if ([self length] == 0) return NSZeroSize; // <-- inserted this > > NSRect usedRect = [self boundingRectWithSize: NSZeroSize > options: > NSStringDrawingUsesLineFragmentOrigin]; > return usedRect.size; > } > > - (NSSize) sizeWithAttributes: (NSDictionary *)attrs > { > if ([self length] == 0) return NSZeroSize; // <-- inserted this > > NSRect usedRect = [self boundingRectWithSize: NSZeroSize > options: > NSStringDrawingUsesLineFragmentOrigin > attributes: attrs]; > return usedRect.size; > } > > Problem gone!! :-) > > Regards, > > Andreas
