Hi everyone,We've had a report or two from users where text will incorrectly draw in an area it's not supposed to. Basically a line fragment (or part of one) from the prior NSTextContainer will draw over text in the current container. The odd part is that both line fragments are the last ones in each of their respective containers. In other words, the glyphs for the fragments are separated from each other by quite a bit of content.
It looks like this (hopefully the PNG comes through):
Picture 1.png
Description: application/applefile
<<inline: Picture 1.png>>
Admittedly we have heavily customized the text layout system, but in the end it's just a series of non-overlapping text views. It could be our drawing code, which I've include below, but it hasn't given us problems before Leopard. We aren't using noncontiguous layout, but even so adding calls to ensureLayoutForTextContainer in drawRect doesn't fix the problem.
Has anyone else seen this before? Unfortunately we've been unable to reproduce the problem ourselves. We didn't receive any reports until after Leopard was released. Searching around the web there appear to be other Leopard related redraw issues, but I haven't seen anything about the Cocoa text system specifically.
Thanks for any help,
~Martin
PS: Our NSTextView subclass handles drawing like this:
- (void) drawRect:(NSRect)rect
{
if( rect.size.height <= 0 ) return;
NSLayoutManager* lm = [self layoutManager];
NSTextContainer* tc = [self textContainer];
NSPoint origin = [self textContainerOrigin];
NSRange glyphRng = (nil == tc) ? NSZeroRange : [lm
glyphRangeForBoundingRect:rect inTextContainer:tc];
// background
[self drawViewBackgroundInRect:rect];
if( 0 != glyphRng.length ) [lm drawBackgroundForGlyphRange:glyphRng
inTextContainer:tc atPoint:origin];
[lm drawSelectionForGlyphRange:glyphRng inTextContainer:tc
atPoint:origin];
// text
if( 0 != glyphRng.length ) {
[NSBezierPath clipRect:rect]; // in case the glyphs being drawn are
not entirely in the redraw rect
[lm drawGlyphsForGlyphRange:glyphRng atPoint:origin];
}
}
- (void) drawViewBackgroundInRect:(NSRect)rect
{
if( [self drawsBackground] ) {
[[self backgroundColor] set];
[NSBezierPath fillRect:rect];
}
}_______________________________________________ Cocoa-dev mailing list ([email protected]) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
