Handle text containers with no area.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@16929 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Alexander Malmberg 2003-06-15 15:18:54 +00:00
parent 31f4f76f01
commit d332316918
2 changed files with 22 additions and 5 deletions

View file

@ -1,3 +1,9 @@
2003-06-15 16:26 Alexander Malmberg <alexander@malmberg.org>
* Source/GSHorizontalTypesetter.m: Use NSIsEmptyRect instead of
comparing for equality with NSZeroRect.
(-layoutLineNewParagraph:): Handle text containers with no area.
2003-06-15 14:57 Alexander Malmberg <alexander@malmberg.org> 2003-06-15 14:57 Alexander Malmberg <alexander@malmberg.org>
* configure.ac: Don't add GNUSTEP_HDIR/GNUSTEP_LDIR to * configure.ac: Don't add GNUSTEP_HDIR/GNUSTEP_LDIR to

View file

@ -455,7 +455,7 @@ Return values 0, 1, 2 are mostly the same as from
break; break;
} }
if (NSEqualRects(r, NSZeroRect) || NSMaxY(r) + shift.height > container_height) if (NSIsEmptyRect(r) || NSMaxY(r) + shift.height > container_height)
break; break;
g = g2; g = g2;
@ -511,7 +511,7 @@ Return values 0, 1, 2 are mostly the same as from
movementDirection: NSLineMoveDown movementDirection: NSLineMoveDown
remainingRect: &remain]; remainingRect: &remain];
if (!NSEqualRects(r, NSZeroRect)) if (!NSIsEmptyRect(r))
{ {
r2 = r; r2 = r;
r2.size.width = 1; r2.size.width = 1;
@ -544,9 +544,19 @@ Return values 0, 1, 2 are mostly the same as from
line_height = max_line_height; line_height = max_line_height;
} }
/* If we find out that we need to increase the line height, we have to /*
If we find out that we need to increase the line height, we have to
start over. The increased line height might give _completely_ different start over. The increased line height might give _completely_ different
line frag rects, so we can't reuse the layout information. */ line frag rects, so we can't reuse the layout information.
OPT: However, we could recreate the line frag rects and see if they
match before throwing away layout information, since most of the time
they will be equivalent.
Also, in the very common case of a simple rectangular text container, we
can always extend the current line frag rects as long as they don't extend
past the bottom of the container.
*/
#define WANT_LINE_HEIGHT(h) \ #define WANT_LINE_HEIGHT(h) \
@ -610,7 +620,8 @@ restart:
if (!line_frags_num) if (!line_frags_num)
{ {
if (curPoint.y == 0.0 && if (curPoint.y == 0.0 &&
line_height > [curTextContainer containerSize].height) line_height > [curTextContainer containerSize].height &&
[curTextContainer containerSize].height > 0.0)
{ {
/* Try to make sure each container contains at least one line frag /* Try to make sure each container contains at least one line frag
rect by shrinking our line height. */ rect by shrinking our line height. */