Merge pull request #37 from trunkmaster/master

Insertion point height fix for NSText* objects
This commit is contained in:
Sergii Stoian 2019-12-11 12:23:06 +02:00 committed by GitHub
commit 063e5708e7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 39 additions and 4 deletions

View file

@ -1,3 +1,24 @@
2019-12-11 Sergii Stoian <stoyan255@gmail.com>
* Source/GSHorizontalTypesetter.m: removed extra imports left from
last 2 commits.
2019-12-10 Sergii Stoian <stoyan255@gmail.com>
* Headers/Additions/GNUstepGUI/GSLayoutManager.h,
* Source/GSLayoutManager.m: new method -typingAttributes returns default
typing attributes of NSTextView.
* Source/NSLayoutManager.m: override GSLayoutManager's -typingAttributes
- primitive method - provides access to _typingAttributes ivar.
* Source/GSHorizontalTypesetter.m: use new GSLayoutManager's
-typingAttributes method to get paragraph style and font of new empty text
container. Normally `curLayoutManager` is a NSLayoutManager object so,
actually, we get NSLayoutManager's _typingAttributes.
* Source/GSHorizontalTypesetter.m: (_addExtraLineFragment) get paragraph
style and font from NSLayoutManager's typing attributes. Fixes insertion
point height for empty text objects (NSTextView, NSTexField etc.).
2019-12-09 Sergii Stoian <stoyan255@gmail.com>
* Source/NSStringDrawing.m: fixed incorrect string drawing (shortened, misplaced)

View file

@ -168,6 +168,7 @@ If characters have been edited, lengthChange has the text length delta.
forStartingGlyphAtIndex: (NSUInteger)glyph
characterIndex: (NSUInteger)index;
- (NSDictionary *) typingAttributes;
@end

View file

@ -534,9 +534,10 @@ For bigger values the width gets ignored.
}
else
{
// FIXME These should come from the typing attributes
curParagraphStyle = [NSParagraphStyle defaultParagraphStyle];
curFont = [NSFont userFontOfSize: 0];
NSDictionary *typingAttributes = [curLayoutManager typingAttributes];
curParagraphStyle = [typingAttributes
objectForKey: NSParagraphStyleAttributeName];
curFont = [typingAttributes objectForKey: NSFontAttributeName];
}
line_height = [curFont defaultLineHeightForFont];

View file

@ -34,6 +34,7 @@
#import "AppKit/NSAttributedString.h"
#import "AppKit/NSTextStorage.h"
#import "AppKit/NSTextContainer.h"
#import "AppKit/NSTextView.h"
/* just for NSAttachmentCharacter */
#import "AppKit/NSTextAttachment.h"
@ -3280,7 +3281,13 @@ forStartingGlyphAtIndex: (NSUInteger)glyph
else if (attributeTag == NSGlyphAttributeBidiLevel)
g->bidilevel = anInt;
}
}
}
- (NSDictionary *) typingAttributes
{
return [NSTextView defaultTypingAttributes];
}
/*
* NSCoding protocol

View file

@ -3017,6 +3017,11 @@ no_soft_invalidation:
}
}
- (NSDictionary *) typingAttributes
{
return _typingAttributes;
}
@end