Author: fredkiefer
Date: Mon Feb 20 23:32:13 2017
New Revision: 40350
URL: http://svn.gna.org/viewcvs/gnustep?rev=40350&view=rev
Log:
* Source/GSHorizontalTypesetter.m (-layoutLineNewParagraph:): Add
extra line fragment for empty string here.
Modified:
libs/gui/trunk/ChangeLog
libs/gui/trunk/Source/GSHorizontalTypesetter.m
Modified: libs/gui/trunk/ChangeLog
URL:
http://svn.gna.org/viewcvs/gnustep/libs/gui/trunk/ChangeLog?rev=40350&r1=40349&r2=40350&view=diff
==============================================================================
--- libs/gui/trunk/ChangeLog (original)
+++ libs/gui/trunk/ChangeLog Mon Feb 20 23:32:13 2017
@@ -1,3 +1,8 @@
+2017-02-20 Fred Kiefer <[email protected]>
+
+ * Source/GSHorizontalTypesetter.m (-layoutLineNewParagraph:): Add
+ extra line fragment for empty string here.
+
2017-02-17 Fred Kiefer <[email protected]>
* Source/GSLayoutManager.m (-usedRectForTextContainer:): Add extra
Modified: libs/gui/trunk/Source/GSHorizontalTypesetter.m
URL:
http://svn.gna.org/viewcvs/gnustep/libs/gui/trunk/Source/GSHorizontalTypesetter.m?rev=40350&r1=40349&r2=40350&view=diff
==============================================================================
--- libs/gui/trunk/Source/GSHorizontalTypesetter.m (original)
+++ libs/gui/trunk/Source/GSHorizontalTypesetter.m Mon Feb 20 23:32:13 2017
@@ -503,6 +503,43 @@
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 @@
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;
}
_______________________________________________
Gnustep-cvs mailing list
[email protected]
https://mail.gna.org/listinfo/gnustep-cvs