NSAttrTextView // Enhance compatibility with macOS 10.11 El Capitan.
- Also fine-tuning the line spacing.
This commit is contained in:
parent
e417be73bb
commit
03d38a80ed
|
@ -65,9 +65,11 @@ public class NSAttributedTextView: NSView {
|
||||||
let isVertical: Bool = !(direction == .horizontal)
|
let isVertical: Bool = !(direction == .horizontal)
|
||||||
newAttributes[.verticalGlyphForm] = isVertical
|
newAttributes[.verticalGlyphForm] = isVertical
|
||||||
let newStyle: NSMutableParagraphStyle = newAttributes[.paragraphStyle] as! NSMutableParagraphStyle
|
let newStyle: NSMutableParagraphStyle = newAttributes[.paragraphStyle] as! NSMutableParagraphStyle
|
||||||
newStyle.lineSpacing = isVertical ? (fontSize / -2) : fontSize * 0.1
|
if #available(macOS 10.13, *) {
|
||||||
newStyle.maximumLineHeight = fontSize
|
newStyle.lineSpacing = isVertical ? (fontSize / -2) : fontSize * 0.1
|
||||||
newStyle.minimumLineHeight = fontSize
|
newStyle.maximumLineHeight = fontSize * 1.1
|
||||||
|
newStyle.minimumLineHeight = fontSize * 1.1
|
||||||
|
}
|
||||||
newAttributes[.paragraphStyle] = newStyle
|
newAttributes[.paragraphStyle] = newStyle
|
||||||
var text: String = text ?? ""
|
var text: String = text ?? ""
|
||||||
if !(direction == .horizontal) {
|
if !(direction == .horizontal) {
|
||||||
|
|
Loading…
Reference in New Issue