Clip the rectangle computed by -rectArrayForGlyphRange: for the last

line to the line fragment's used rectangle if the line doesn't end
with a newline (or other invisible character). This better matches
Apple's implementation.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@31720 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
wlux 2010-12-09 18:04:25 +00:00
parent 7875e3ec25
commit d32eb3d880
2 changed files with 29 additions and 0 deletions

View file

@ -350,6 +350,28 @@ container? necessary? */
GLYPH_STEP_FORWARD(r, i, gpos, cpos)
}
}
else if (lf->pos + lf->length == last)
{
/*
The range ends in the last glyph of the line frag, so the end
x-coordinate is the right edge of this glyph. This egde is
equal to the right edge of the line fragment's rectangle if
the glyph is invisible or a control glyph, e.g., a newline,
and to the right edge of the line fragment's used rectangle
otherwise.
*/
NSUInteger i;
glyph_run_t *r;
unsigned int gpos, cpos;
r = run_for_glyph_index(last - 1, glyphs, &gpos, &cpos);
i = (last - 1) - gpos;
if (!r->glyphs[i].isNotShown && r->glyphs[i].g &&
r->glyphs[i].g != NSControlGlyph)
x1 = NSMaxX(lf->used_rect);
else
x1 = NSMaxX(lf->rect);
}
else
{
/*