[Top][All Lists]

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

Re: NSTextField problems

From: Alexander Malmberg
Subject: Re: NSTextField problems
Date: Tue, 28 Jan 2003 17:11:33 +0100

Enrico Sersale wrote:
> Ok, now cliking in a NSTextField doesn't crash the app anymore, but:
> - after the first mouseDown:
> 1) the text dishappears.
> 2) I get a:
>  -[NSLayoutManager(layout)
> rectArrayForGlyphRange:withinSelectedGlyphRange:inTextContainer:rectCount:]:
> invalid text container

I've been able to reproduce this, and I've tracked it down to the cell
not being tall enough for the text that's in it. In the case where I
could reproduce it (the 'To' field in the print panel), the cell is 13.5
points tall, but the text is 14 points tall. The easy way to fix this is
to simply make the cell tall enough to fit the text. I'll also try to
fix handling of glyphs that aren't laid out so it'll behave a bit more
gracefully when this happens.

I'm not really sure what the best way to really fix it is, though. The
typesetter and layout manager are correct in not laying out any glyphs,
since the text actually doesn't fit in the cell. On the other hand, the
current behavior isn't good, since it breaks very easily (if a cell
isn't tall enough, or if someone uses larger fonts).

One solution might be to add some border case handling to
GSHorizontalTypesetter to ensure that every text container contains at
least one line frag rect. (There is already similar code there to ensure
that every line frag contains at least one glyph. This was necessary to
solve a somewhat similar problem, but on a line-level and not a
container-level.) If this works, I'll commit this (until we find a
better solution, or find that there isn't one).

- Alexander Malmberg

reply via email to

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