Re: A horizontal line rule within a NSAttributedString?

2017-02-18 Thread Aleksei Kac
Here is what I use on macOS: open class FSHorizontalRuleAttachmentCell: NSTextAttachmentCell { override open func cellFrame(for textContainer: NSTextContainer, proposedLineFragment lineFrag: NSRect, glyphPosition position: NSPoint, characterIndex charIndex: Int) -> NSRect {

Re: A horizontal line rule within a NSAttributedString?

2017-02-18 Thread Gary L. Wade
Either try subclassing NSTextAttachment and overriding the methods in NSTextAttachmentContainer or use a subclass of NSTextAttachmentCell. -- Gary L. Wade http://www.garywade.com/ > On Feb 18, 2017, at 3:26 PM, Daryle Walker wrote: > > What is the

Re: A horizontal line rule within a NSAttributedString?

2017-02-18 Thread Daryle Walker
What is the attachment supposed to be? An image of a line? That doesn’t seem scalable (to the page size). And the effort seems to be the same as figuring out NSTextBlock. > On Feb 18, 2017, at 5:43 PM, Gary L. Wade > wrote: > > I would use NSTextAttachment,

Re: A horizontal line rule within a NSAttributedString?

2017-02-18 Thread Gary L. Wade
I would use NSTextAttachment, create an attributed string from it, and combine your three attributed strings into one. -- Gary L. Wade http://www.garywade.com/ > On Feb 18, 2017, at 2:16 PM, Daryle Walker wrote: > > An idea for formatted output of my

A horizontal line rule within a NSAttributedString?

2017-02-18 Thread Daryle Walker
An idea for formatted output of my data is the two sections turned into attributed strings, with a line between them. But I couldn’t figure out how to make a line. I didn’t want to resort to raw drawing commands. I prefer not to create (X)HTML representations (so I could put a “” in between).