* Source/GSHorizontalTypesetter.m (-layoutLineNewParagraph:): Add

extra line fragment for empty string here.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@40350 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Fred Kiefer 2017-02-20 22:32:13 +00:00
parent a33b4c5073
commit 1323c50d6e
2 changed files with 44 additions and 28 deletions

View file

@ -1,3 +1,8 @@
2017-02-20 Fred Kiefer <FredKiefer@gmx.de>
* Source/GSHorizontalTypesetter.m (-layoutLineNewParagraph:): Add
extra line fragment for empty string here.
2017-02-17 Fred Kiefer <FredKiefer@gmx.de>
* Source/GSLayoutManager.m (-usedRectForTextContainer:): Add extra

View file

@ -503,6 +503,43 @@ For bigger values the width gets ignored.
line_height + [curParagraphStyle lineSpacing]);
}
- (void) _addExtraLineFragment
{
NSRect r, r2, remain;
CGFloat line_height;
/*
We aren't actually interested in the glyph data, but we want the
attributes for the final character so we can make the extra line
frag rect match it. This call makes sure that curFont is set.
*/
if (curGlyph)
{
[self _cacheMoveTo: curGlyph - 1];
}
else
{
curFont = [NSFont userFontOfSize: 0];
}
line_height = [curFont defaultLineHeightForFont];
r = [self _getProposedRectFor: YES
withLineHeight: line_height];
r = [curTextContainer lineFragmentRectForProposedRect: r
sweepDirection: NSLineSweepRight
movementDirection: NSLineMovesDown
remainingRect: &remain];
if (!NSIsEmptyRect(r))
{
r2 = r;
r2.size.width = 1;
[curLayoutManager setExtraLineFragmentRect: r
usedRect: r2
textContainer: curTextContainer];
}
}
/*
Return values 0, 1, 2 are mostly the same as from
-layoutGlyphsInLayoutManager:.... Additions:
@ -567,37 +604,11 @@ Return values 0, 1, 2 are mostly the same as from
new-line, we set the extra line frag rect here so the insertion point
will be properly positioned after a trailing newline in the text.
*/
NSRect r, r2, remain;
if (!newParagraph || !curGlyph)
if (newParagraph)
{
return 2;
[self _addExtraLineFragment];
}
/*
We aren't actually interested in the glyph data, but we want the
attributes for the final character so we can make the extra line
frag rect match it. This call makes sure that cur* are set.
*/
[self _cacheMoveTo: curGlyph - 1];
line_height = [curFont defaultLineHeightForFont];
r = [self _getProposedRectFor: newParagraph
withLineHeight: line_height];
r = [curTextContainer lineFragmentRectForProposedRect: r
sweepDirection: NSLineSweepRight
movementDirection: NSLineMovesDown
remainingRect: &remain];
if (!NSIsEmptyRect(r))
{
r2 = r;
r2.size.width = 1;
[curLayoutManager setExtraLineFragmentRect: r
usedRect: r2
textContainer: curTextContainer];
}
return 2;
}