2004-11-09 22:08 Alexander Malmberg <alexander@malmberg.org>

* Source/GSHorizontalTypesetter.m (-layoutLineNewParagraph:):
	Implement NSLineBreakByClipping. Set outside_line_frag and dont_show
	attributes for every glyph.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@20330 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Alexander Malmberg 2004-11-09 21:14:36 +00:00
parent 28fe7becc9
commit 0958e055fa
2 changed files with 58 additions and 12 deletions

View file

@ -1,3 +1,9 @@
2004-11-09 22:08 Alexander Malmberg <alexander@malmberg.org>
* Source/GSHorizontalTypesetter.m (-layoutLineNewParagraph:):
Implement NSLineBreakByClipping. Set outside_line_frag and dont_show
attributes for every glyph.
2004-11-09 18:55 Alexander Malmberg <alexander@malmberg.org> 2004-11-09 18:55 Alexander Malmberg <alexander@malmberg.org>
* Source/NSPasteboard.m (+_pbs): Give gpbs a --GSStartupNotification * Source/NSPasteboard.m (+_pbs): Give gpbs a --GSStartupNotification

View file

@ -969,11 +969,52 @@ restart: ;
if (lf->last_glyph <= first_glyph) if (lf->last_glyph <= first_glyph)
goto char_wrapping; goto char_wrapping;
break; break;
case NSLineBreakByTruncatingHead:
case NSLineBreakByTruncatingMiddle:
case NSLineBreakByTruncatingTail:
/* Pretending that these are clipping is far from prefect,
but it's the closest we've got. */
case NSLineBreakByClipping:
/* Scan forward to the next paragraph separator and mark
all the glyphs up to there as not visible. */
g->outside_line_frag = YES;
while (1)
{
i++;
g++;
/* Update the cache. */
if (i >= cache_length)
{
if (at_end)
{
newParagraph = NO;
i--;
break;
}
[self _cacheGlyphs: cache_length + CACHE_STEP];
if (i >= cache_length)
{
newParagraph = NO;
i--;
break;
}
g = cache + i;
}
g->dont_show = YES;
g->pos = p;
if (g->g == NSControlGlyph
&& [[curTextStorage string]
characterAtIndex: g->char_index] == 0xa)
break;
}
lf->last_glyph = i + 1;
break;
} }
/* We force at least one glyph into each line frag rect. This /* We force at least one glyph into each line frag rect. This
ensures that typesetting will never get stuck (ie. if the text ensures that typesetting will never get stuck (ie. if the text
container is to narrow to fit even a single glyph). */ container is too narrow to fit even a single glyph). */
if (lf->last_glyph <= first_glyph) if (lf->last_glyph <= first_glyph)
lf->last_glyph = i + 1; lf->last_glyph = i + 1;
@ -1062,21 +1103,20 @@ restart: ;
forGlyphRange: NSMakeRange(cache_base + i, lf->last_glyph - i) forGlyphRange: NSMakeRange(cache_base + i, lf->last_glyph - i)
usedRect: used_rect]; usedRect: used_rect];
p = g->pos; p = g->pos;
/* TODO: probably don't need to call unless the flags are YES */
if (g->outside_line_frag)
{
[curLayoutManager setDrawsOutsideLineFragment: YES
forGlyphAtIndex: cache_base + i];
}
if (g->dont_show)
{
[curLayoutManager setNotShownAttribute: YES
forGlyphAtIndex: cache_base + i];
}
p.y += baseline; p.y += baseline;
j = i; j = i;
while (i < lf->last_glyph) while (i < lf->last_glyph)
{ {
if (g->outside_line_frag)
{
[curLayoutManager setDrawsOutsideLineFragment: YES
forGlyphAtIndex: cache_base + i];
}
if (g->dont_show)
{
[curLayoutManager setNotShownAttribute: YES
forGlyphAtIndex: cache_base + i];
}
if (!g->nominal && i != j) if (!g->nominal && i != j)
{ {
[curLayoutManager setLocation: p [curLayoutManager setLocation: p