Don't draw spelling underlines when printing

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@32567 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
ericwa 2011-03-14 09:05:29 +00:00
parent e3682ec0be
commit 7d4aa82c88
2 changed files with 36 additions and 28 deletions

View file

@ -1,3 +1,8 @@
2011-03-14 Eric Wasylishen <ewasylishen@gmail.com>
* Source/NSLayoutManager.m: Don't draw spelling underlines
when printing
2011-03-14 Eric Wasylishen <ewasylishen@gmail.com> 2011-03-14 Eric Wasylishen <ewasylishen@gmail.com>
* Source/NSTextView.m: Attempt to add pagination support * Source/NSTextView.m: Attempt to add pagination support

View file

@ -1732,37 +1732,40 @@ for (i = 0; i < gbuf_len; i++) printf(" %3i : %04x\n", i, gbuf[i]); */
// Draw spelling state (i.e. red underline for misspelled words) // Draw spelling state (i.e. red underline for misspelled words)
for (i=characterRange.location; i<NSMaxRange(characterRange); ) if ([NSGraphicsContext currentContextDrawingToScreen])
{ {
NSRange underlinedCharacterRange; for (i=characterRange.location; i<NSMaxRange(characterRange); )
id underlineValue = [self temporaryAttribute: NSSpellingStateAttributeName
atCharacterIndex: i
longestEffectiveRange: &underlinedCharacterRange
inRange: characterRange];
if (underlineValue != nil && [underlineValue integerValue] != 0)
{ {
const NSRange underlinedGylphRange = [self glyphRangeForCharacterRange: underlinedCharacterRange NSRange underlinedCharacterRange;
actualCharacterRange: NULL]; id underlineValue = [self temporaryAttribute: NSSpellingStateAttributeName
atCharacterIndex: i
// we have a range of glpyhs that need underlining, which might span longestEffectiveRange: &underlinedCharacterRange
// multiple line fragments, so we need to iterate though the line fragments inRange: characterRange];
for (j=underlinedGylphRange.location; j<NSMaxRange(underlinedGylphRange); ) if (underlineValue != nil && [underlineValue integerValue] != 0)
{ {
NSRange lineFragmentGlyphRange; const NSRange underlinedGylphRange = [self glyphRangeForCharacterRange: underlinedCharacterRange
const NSRect lineFragmentRect = [self lineFragmentRectForGlyphAtIndex: j actualCharacterRange: NULL];
effectiveRange: &lineFragmentGlyphRange];
const NSRange rangeToUnderline = NSIntersectionRange(underlinedGylphRange, lineFragmentGlyphRange);
[self _drawSpellingState: [underlineValue integerValue] // we have a range of glpyhs that need underlining, which might span
forGylphRange: rangeToUnderline // multiple line fragments, so we need to iterate though the line fragments
lineFragmentRect: lineFragmentRect for (j=underlinedGylphRange.location; j<NSMaxRange(underlinedGylphRange); )
lineFragmentGlyphRange: lineFragmentGlyphRange {
containerOrigin: containerOrigin]; NSRange lineFragmentGlyphRange;
const NSRect lineFragmentRect = [self lineFragmentRectForGlyphAtIndex: j
effectiveRange: &lineFragmentGlyphRange];
const NSRange rangeToUnderline = NSIntersectionRange(underlinedGylphRange, lineFragmentGlyphRange);
j = NSMaxRange(rangeToUnderline); [self _drawSpellingState: [underlineValue integerValue]
forGylphRange: rangeToUnderline
lineFragmentRect: lineFragmentRect
lineFragmentGlyphRange: lineFragmentGlyphRange
containerOrigin: containerOrigin];
j = NSMaxRange(rangeToUnderline);
}
} }
i += underlinedCharacterRange.length;
} }
i += underlinedCharacterRange.length;
} }
} }
} }