From ebcf1cb3455cedb9ea1aafd464b42c68e4596a73 Mon Sep 17 00:00:00 2001 From: James Bursa Date: Tue, 15 Jul 2003 23:11:03 +0000 Subject: [project @ 2003-07-15 23:11:03 by bursa] Fix first letter cut off bug. svn path=/import/netsurf/; revision=223 --- render/layout.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/render/layout.c b/render/layout.c index 1fb27b77c..7949d1d3a 100644 --- a/render/layout.c +++ b/render/layout.c @@ -459,7 +459,7 @@ struct box * layout_line(struct box * first, unsigned long width, unsigned long else w = font_width(c->font, c->text, (unsigned int) (space - c->text)); - if (x1 - x0 < x + space_before + w && left == 0 && right == 0 && c == first) { + if (x1 - x0 <= x + space_before + w && left == 0 && right == 0 && c == first) { /* first word doesn't fit, but no floats and first on line so force in */ if (space == 0) { /* only one word in this box or not text */ @@ -479,7 +479,7 @@ struct box * layout_line(struct box * first, unsigned long width, unsigned long } x += space_before + w; /* fprintf(stderr, "layout_line: overflow, forcing\n"); */ - } else if (x1 - x0 < x + space_before + w) { + } else if (x1 - x0 <= x + space_before + w) { /* first word doesn't fit, but full width not available so leave for later */ b = c; /* fprintf(stderr, "layout_line: overflow, leaving\n"); */ @@ -490,6 +490,7 @@ struct box * layout_line(struct box * first, unsigned long width, unsigned long x1 - x0 - x - space_before, &w); LOG(("'%.*s' %lu %u (%c) %u", (int) c->length, c->text, (unsigned long) (x1 - x0), space - c->text, *space, w)); + assert(space != c->text); c2 = memcpy(xcalloc(1, sizeof(struct box)), c, sizeof(struct box)); c2->text = xstrdup(space + 1); c2->length = c->length - ((space + 1) - c->text); -- cgit v1.2.3