• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSTextView overdraw bug in Leopard?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSTextView overdraw bug in Leopard?


  • Subject: Re: NSTextView overdraw bug in Leopard?
  • From: Gerd Knops <email@hidden>
  • Date: Tue, 22 Jul 2008 11:51:43 -0500


On Jul 21, 2008, at 6:10 PM, Martin Wierschin wrote:

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.

I have seen something vaguely similar that may or may not be related: I implemented drop caps by having a NSTextContainer subclass counting lines and modifying the lineFragmentRect (see below). After migrating to Leopard that would occasionally fail, typically only for documents that caused the application to launch and documents opened later were fine. It was seldom reproducible, and I have not seen it in a while so it may or may not have been fixed in a later Leopard version. Spent a day debugging it without much luck.


Gerd


@implementation RATETextContainer

- (id)initWithContainerSize:(NSSize)size leftOffset: (float)newLeftOffset forNumLines:(int)newNumLines {

if(self=[super initWithContainerSize:size])
{
leftOffset=newLeftOffset;
numOffsetLines=newNumLines;

currentLinesToOffset=newNumLines;
}

return self;
}
- (NSRect)lineFragmentRectForProposedRect:(NSRect)proposedRect sweepDirection:(NSLineSweepDirection)sweepDirection movementDirection: (NSLineMovementDirection)movementDirection remainingRect:(NSRect *)remainingRect {

if(proposedRect.origin.y==0)
{
// reset at the beginning of the container
currentLinesToOffset=numOffsetLines;
}

NSRect r=[super lineFragmentRectForProposedRect:proposedRect sweepDirection:sweepDirection movementDirection:movementDirection remainingRect:remainingRect];

if(numOffsetLines)
{
numOffsetLines--;
r.origin.x+=leftOffset;
r.size.width-=leftOffset;
}

return r;
}
- (BOOL)isSimpleRectangularTextContainer {

return NO;
}


@end

_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:
This email sent to email@hidden


  • Follow-Ups:
    • Re: NSTextView overdraw bug in Leopard?
      • From: Martin Wierschin <email@hidden>
References: 
 >NSTextView overdraw bug in Leopard? (From: Martin Wierschin <email@hidden>)

  • Prev by Date: Binding TableColumn Programatically
  • Next by Date: Re: Newbie CALayer Questions
  • Previous by thread: NSTextView overdraw bug in Leopard?
  • Next by thread: Re: NSTextView overdraw bug in Leopard?
  • Index(es):
    • Date
    • Thread