mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-31 19:10:48 +00:00
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:
parent
e3682ec0be
commit
7d4aa82c88
2 changed files with 36 additions and 28 deletions
|
@ -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
|
||||||
|
|
|
@ -1731,38 +1731,41 @@ 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); )
|
|
||||||
{
|
|
||||||
NSRange underlinedCharacterRange;
|
|
||||||
id underlineValue = [self temporaryAttribute: NSSpellingStateAttributeName
|
|
||||||
atCharacterIndex: i
|
|
||||||
longestEffectiveRange: &underlinedCharacterRange
|
|
||||||
inRange: characterRange];
|
|
||||||
if (underlineValue != nil && [underlineValue integerValue] != 0)
|
|
||||||
{
|
|
||||||
const NSRange underlinedGylphRange = [self glyphRangeForCharacterRange: underlinedCharacterRange
|
|
||||||
actualCharacterRange: NULL];
|
|
||||||
|
|
||||||
// we have a range of glpyhs that need underlining, which might span
|
|
||||||
// multiple line fragments, so we need to iterate though the line fragments
|
|
||||||
for (j=underlinedGylphRange.location; j<NSMaxRange(underlinedGylphRange); )
|
|
||||||
{
|
|
||||||
NSRange lineFragmentGlyphRange;
|
|
||||||
const NSRect lineFragmentRect = [self lineFragmentRectForGlyphAtIndex: j
|
|
||||||
effectiveRange: &lineFragmentGlyphRange];
|
|
||||||
const NSRange rangeToUnderline = NSIntersectionRange(underlinedGylphRange, lineFragmentGlyphRange);
|
|
||||||
|
|
||||||
[self _drawSpellingState: [underlineValue integerValue]
|
if ([NSGraphicsContext currentContextDrawingToScreen])
|
||||||
forGylphRange: rangeToUnderline
|
{
|
||||||
lineFragmentRect: lineFragmentRect
|
for (i=characterRange.location; i<NSMaxRange(characterRange); )
|
||||||
lineFragmentGlyphRange: lineFragmentGlyphRange
|
{
|
||||||
containerOrigin: containerOrigin];
|
NSRange underlinedCharacterRange;
|
||||||
|
id underlineValue = [self temporaryAttribute: NSSpellingStateAttributeName
|
||||||
|
atCharacterIndex: i
|
||||||
|
longestEffectiveRange: &underlinedCharacterRange
|
||||||
|
inRange: characterRange];
|
||||||
|
if (underlineValue != nil && [underlineValue integerValue] != 0)
|
||||||
|
{
|
||||||
|
const NSRange underlinedGylphRange = [self glyphRangeForCharacterRange: underlinedCharacterRange
|
||||||
|
actualCharacterRange: NULL];
|
||||||
|
|
||||||
j = NSMaxRange(rangeToUnderline);
|
// we have a range of glpyhs that need underlining, which might span
|
||||||
|
// multiple line fragments, so we need to iterate though the line fragments
|
||||||
|
for (j=underlinedGylphRange.location; j<NSMaxRange(underlinedGylphRange); )
|
||||||
|
{
|
||||||
|
NSRange lineFragmentGlyphRange;
|
||||||
|
const NSRect lineFragmentRect = [self lineFragmentRectForGlyphAtIndex: j
|
||||||
|
effectiveRange: &lineFragmentGlyphRange];
|
||||||
|
const NSRange rangeToUnderline = NSIntersectionRange(underlinedGylphRange, lineFragmentGlyphRange);
|
||||||
|
|
||||||
|
[self _drawSpellingState: [underlineValue integerValue]
|
||||||
|
forGylphRange: rangeToUnderline
|
||||||
|
lineFragmentRect: lineFragmentRect
|
||||||
|
lineFragmentGlyphRange: lineFragmentGlyphRange
|
||||||
|
containerOrigin: containerOrigin];
|
||||||
|
|
||||||
|
j = NSMaxRange(rangeToUnderline);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
i += underlinedCharacterRange.length;
|
||||||
}
|
}
|
||||||
i += underlinedCharacterRange.length;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue