On Aug 17, 2011, at 10:59 AM, Ross Carter wrote: > OK, I see the problem. It looks like your source text was copied from a web > page. (Fonts Arial and Verdana are a clue.) There is something peculiar in > your text formatting. I'll bet that the web page embedded that text in a > table and the conversion from web to RTF has left some table artifacts in the > formatting. The NSParagraphStyle settings in your RTF document look like this: > > NSParagraphStyle = "Alignment 4, LineSpacing 0, ParagraphSpacing 0, > ParagraphSpacingBefore 0, HeadIndent 0, TailIndent 0, FirstLineHeadIndent 0, > LineHeight 16/0, LineHeightMultiple 0, LineBreakMode 0, Tabs (\n), > DefaultTabInterval 36, Blocks (\n \"<NSTextTableBlock: 0x14aa840>\"\n), > Lists (null), BaseWritingDirection 0, HyphenationFactor 0, TighteningFactor > 0.05, HeaderLevel 0"; > > Notice the NSTextTableBlock object. It should not be there. > > Also, the minimum line height setting of 16 points is a relic of web layout > that is not particularly useful in traditional text layout (IMHO), although > is not a problem per se. > > I ran the RTF doc through TextMate to remove all the formatting, pasted it in > TextEdit, added back the formatting by hand, and the problem was gone. You > could do this in code; just set NSParagraphStyle textBlocks to nil. Maybe > while you're at it, set minimumLineHeight to 0 and, if you want more spacing, > set lineHeightMultiple to 1.1 or thereabouts.
Thank you very much for your help. Removing the text blocks did indeed fix the problem; I would've never guessed that would be the problem. Here is a category method that applies the solution when called, in case anyone else ever runs into this problem with their own non-contiguous series of text views: @implementation NSMutableAttributedString (PageViewExtension) - (void)fixAttributesForDisplayInPageView { NSMutableSet *weDidTheseAlready = [NSMutableSet set]; [self beginEditing]; [self enumerateAttribute:NSParagraphStyleAttributeName inRange:NSMakeRange(0UL, self.length) options:0UL usingBlock:^(id value, NSRange range, BOOL *stop){ NSMutableParagraphStyle *alteredStyle = [value mutableCopy]; NSValue *rangeValue = [NSValue valueWithRange:range]; alteredStyle.textBlocks = nil; // remove text blocks; they cause text to get cut off during pagination alteredStyle.minimumLineHeight = 0.0; [self addAttribute:NSParagraphStyleAttributeName value:alteredStyle range:range]; [alteredStyle release]; if ([weDidTheseAlready containsObject:rangeValue]) *stop = YES; else [weDidTheseAlready addObject:rangeValue]; }]; [self endEditing]; } @end Nick Zitzmann <http://www.chronosnet.com/> _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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 arch...@mail-archive.com