Give better error message for an invalid glyph range.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@15746 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Alexander Malmberg 2003-01-28 16:44:53 +00:00
parent 46f18bc1ff
commit bf56e3e54e
2 changed files with 16 additions and 2 deletions

View file

@ -1,3 +1,12 @@
2003-01-28 17:40 Alexander Malmberg <alexander@malmberg.org>
* Source/GSHorizontalTypesetter.m, Source/GSLayoutManager.m:
Whitespace cleanups and comments.
Source/NSLayoutManager.m: (-rectArrayForGlyphRange:
withinSelectedGlyphRange:inTextContainer:rectCount:): Give better
error message for an invalid glyph range.
2003-01-27 16:13 Alexander Malmberg <alexander@malmberg.org>
* Source/NSLayoutManager.m (-setHyphenationFactor:): Fix format

View file

@ -41,6 +41,7 @@ http://wiki.gnustep.org/index.php/NominallySpacedGlyphs
#include "AppKit/NSLayoutManager.h"
#include "AppKit/GSLayoutManager_internal.h"
#include <Foundation/NSException.h>
#include <AppKit/NSColor.h>
#include <AppKit/NSTextContainer.h>
#include <AppKit/NSTextStorage.h>
@ -121,16 +122,20 @@ container? necessary? */
float x0, x1;
NSRect r;
[self _doLayoutToGlyph: last - 1];
for (tc = textcontainers, i = 0; i < num_textcontainers; i++, tc++)
if (tc->textContainer == container)
break;
[self _doLayoutToGlyph: last - 1];
if (i == num_textcontainers ||
tc->pos + tc->length < last ||
tc->pos > glyphRange.location)
{
NSLog(@"%s: invalid text container", __PRETTY_FUNCTION__);
if (i == num_textcontainers)
NSLog(@"%s: invalid text container", __PRETTY_FUNCTION__);
else
[NSException raise: NSRangeException
format: @"%s invalid glyph range", __PRETTY_FUNCTION__];
*rectCount = 0;
return NULL;
}