mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-23 20:01:11 +00:00
(-glyphRangeForBoundingRect:inTextContainer:): Fix the horizontal intersection checks.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@16075 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
b48bf809c7
commit
005bacbebb
2 changed files with 8 additions and 19 deletions
|
@ -1,3 +1,9 @@
|
|||
2003-02-26 17:09 Alexander Malmberg <alexander@malmberg.org>
|
||||
|
||||
* Source/NSLayoutManager.m
|
||||
(-glyphRangeForBoundingRect:inTextContainer:): Fix the horizontal
|
||||
intersection checks.
|
||||
|
||||
2003-02-26 00:47 Alexander Malmberg <alexander@malmberg.org>
|
||||
|
||||
* Source/GSLayoutManager.m (-_generateRunsToCharacter:): Optimize
|
||||
|
|
|
@ -446,11 +446,6 @@ line frag rect. */
|
|||
NSRange range;
|
||||
|
||||
|
||||
/* NSLog(@"%@ %s (%g %g)+(%g %g) in %@\n", self, __PRETTY_FUNCTION__,
|
||||
bounds.origin.x, bounds.origin.y,
|
||||
bounds.size.width, bounds.size.height,
|
||||
container);*/
|
||||
|
||||
for (tc = textcontainers, i = 0; i < num_textcontainers; i++, tc++)
|
||||
if (tc->textContainer == container)
|
||||
break;
|
||||
|
@ -489,18 +484,15 @@ line frag rect. */
|
|||
i = low;
|
||||
lf = &tc->linefrags[i];
|
||||
|
||||
// printf("low=%i (%g+%g) %g\n",low,lf->rect.origin.y,lf->rect.size.height,NSMinY(bounds));
|
||||
|
||||
if (NSMaxY(lf->rect) < NSMinY(bounds))
|
||||
{
|
||||
// printf(" empty (bounds below text)\n");
|
||||
return NSMakeRange(0, 0);
|
||||
}
|
||||
|
||||
/* Scan to first line frag intersecting bounds horizontally. */
|
||||
while (i < tc->num_linefrags - 1 &&
|
||||
NSMinY(lf[0].rect) == NSMinY(lf[1].rect) &&
|
||||
NSMaxX(lf[1].rect) < NSMinX(bounds))
|
||||
NSMaxX(lf[0].rect) < NSMinX(bounds))
|
||||
i++, lf++;
|
||||
|
||||
/* TODO: find proper position in line frag rect */
|
||||
|
@ -529,34 +521,26 @@ line frag rect. */
|
|||
if (i && NSMinY(lf->rect) > NSMaxY(bounds))
|
||||
i--, lf--;
|
||||
|
||||
// printf("low=%i (%i) (%g+%g) %g\n",low,tc->num_linefrags,lf->rect.origin.y,lf->rect.size.height,NSMaxY(bounds));
|
||||
|
||||
if (NSMinY(lf->rect) > NSMaxY(bounds))
|
||||
{
|
||||
// printf(" empty (bounds above text)\n");
|
||||
return NSMakeRange(0, 0);
|
||||
}
|
||||
|
||||
/* Scan to last line frag intersecting bounds horizontally. */
|
||||
while (i > 0 &&
|
||||
NSMinY(lf[0].rect) == NSMinY(lf[-1].rect) &&
|
||||
NSMinX(lf[1].rect) > NSMaxX(bounds))
|
||||
NSMinX(lf[-1].rect) > NSMaxX(bounds))
|
||||
i--, lf--;
|
||||
// printf("i=%i\n",i);
|
||||
|
||||
/* TODO: find proper position in line frag rect */
|
||||
|
||||
j = lf->pos + lf->length;
|
||||
if (j <= range.location)
|
||||
{
|
||||
// printf(" empty (bound between lines?)\n");
|
||||
return NSMakeRange(0, 0);
|
||||
}
|
||||
|
||||
range.length = j - range.location;
|
||||
/* printf(" range= %i - %i |%@|\n",
|
||||
range.location,range.length,
|
||||
[[_textStorage string] substringWithRange: range]);*/
|
||||
return range;
|
||||
}
|
||||
|
||||
|
@ -1308,7 +1292,6 @@ container
|
|||
|
||||
NSView *controlView = nil;
|
||||
|
||||
|
||||
if (!range.length)
|
||||
return;
|
||||
[self _doLayoutToGlyph: range.location + range.length - 1];
|
||||
|
|
Loading…
Reference in a new issue