(-breakLineByWordWrappingBefore:): Return correct index when breaking at a control glyph.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@15917 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Alexander Malmberg 2003-02-09 17:37:04 +00:00
parent 1368fb95c9
commit 39b3c70b7d
2 changed files with 13 additions and 4 deletions

View file

@ -1,3 +1,8 @@
2003-02-09 18:34 Alexander Malmberg <alexander@malmberg.org>
* Source/GSHorizontalTypesetter.m (-breakLineByWordWrappingBefore:):
Return correct index when breaking at a control glyph.
2003-02-09 18:02 Alexander Malmberg <alexander@malmberg.org> 2003-02-09 18:02 Alexander Malmberg <alexander@malmberg.org>
* Headers/gnustep/gui/GSLayoutManager_internal.h, * Headers/gnustep/gui/GSLayoutManager_internal.h,

View file

@ -229,8 +229,9 @@ the last time or not, we wouldn't need to clear the cache every time */
/* /*
Should return the first glyph on the next line, which must be <=gi and Should return the first glyph on the next line, which must be <=gi and
>=cache_base (TODO: not enough). Glyphs up to and including gi will have >=cache_base (TODO: not enough. actually, it probably is now. the wrapping
been cached. logic below will fall back to char wrapping if necessary). Glyphs up to and
including gi will have been cached.
*/ */
-(unsigned int) breakLineByWordWrappingBefore: (unsigned int)gi -(unsigned int) breakLineByWordWrappingBefore: (unsigned int)gi
{ {
@ -244,7 +245,7 @@ been cached.
while (gi > 0) while (gi > 0)
{ {
if (g->g == NSControlGlyph) if (g->g == NSControlGlyph)
return gi; return gi + cache_base;
ch = [str characterAtIndex: g->char_index]; ch = [str characterAtIndex: g->char_index];
if (ch == 0x20 || ch == 0x0a || ch == 0x0d /* TODO: paragraph/line separator */ ) if (ch == 0x20 || ch == 0x0a || ch == 0x0d /* TODO: paragraph/line separator */ )
{ {
@ -709,9 +710,12 @@ restart:
/* TODO: this is a major bottleneck */ /* TODO: this is a major bottleneck */
/* if (last_glyph) /* if (last_glyph)
{ {
BOOL n;
p = [f positionOfGlyph: g->g p = [f positionOfGlyph: g->g
precededByGlyph: last_glyph precededByGlyph: last_glyph
isNominal: &g->nominal]; isNominal: &n];
if (!n)
g->nominal = NO;
p.x += last_p.x; p.x += last_p.x;
p.y += last_p.y; p.y += last_p.y;
}*/ }*/