mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-23 07:00:46 +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
6af7d4f8b0
commit
f14cd5a450
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>
|
||||
|
||||
* 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)
|
||||
|
||||
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]
|
||||
forGylphRange: rangeToUnderline
|
||||
lineFragmentRect: lineFragmentRect
|
||||
lineFragmentGlyphRange: lineFragmentGlyphRange
|
||||
containerOrigin: containerOrigin];
|
||||
if ([NSGraphicsContext currentContextDrawingToScreen])
|
||||
{
|
||||
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];
|
||||
|
||||
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…
Reference in a new issue