Skip to content

Commit

Permalink
Removes lineHeightMultiplier from DefaultStringAttributes (#361)
Browse files Browse the repository at this point in the history
* Removes lineHeightMultiplier from DefaultStringAttributes

* Removes initializer
  • Loading branch information
simonbs committed Mar 16, 2024
1 parent e21d5ac commit c09a14f
Showing 1 changed file with 4 additions and 20 deletions.
24 changes: 4 additions & 20 deletions Sources/Runestone/Library/DefaultStringAttributes.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,15 @@ import Foundation
import UIKit

struct DefaultStringAttributes {
private let textColor: UIColor
private let font: UIFont
private let kern: CGFloat
private let tabWidth: CGFloat
private let lineHeightMultiplier: CGFloat

init(
textColor: UIColor,
font: UIFont,
kern: CGFloat,
tabWidth: CGFloat,
lineHeightMultiplier: CGFloat = 1
) {
self.textColor = textColor
self.font = font
self.kern = kern
self.tabWidth = tabWidth
self.lineHeightMultiplier = lineHeightMultiplier
}
let textColor: UIColor
let font: UIFont
let kern: CGFloat
let tabWidth: CGFloat

func apply(to attributedString: NSMutableAttributedString) {
let paragraphStyle = NSMutableParagraphStyle()
paragraphStyle.tabStops = []
paragraphStyle.defaultTabInterval = tabWidth
paragraphStyle.lineHeightMultiple = lineHeightMultiplier
let range = NSRange(location: 0, length: attributedString.length)
let attributes: [NSAttributedString.Key: Any] = [
.foregroundColor: textColor,
Expand Down

0 comments on commit c09a14f

Please sign in to comment.