Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removes lineHeightMultiplier from DefaultStringAttributes #361

Merged
merged 3 commits into from
Mar 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading