Skip to content

Commit dfb037f

Browse files
committed
Merge branch 'issue/allow_change_of_default_font' into issue/update_xcode_ios_version
2 parents f7561ef + fa4c640 commit dfb037f

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

Aztec/Classes/TextKit/TextView.swift

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,8 @@ open class TextView: UITextView {
226226

227227
// MARK: - Properties: UI Defaults
228228

229+
/// The font to use to render any HTML that doesn't specify an explicit font.
230+
/// If this is changed all the instances that use this font will be updated to the new one.
229231
public var defaultFont: UIFont {
230232
didSet {
231233
textStorage.replace(font: oldValue, with: defaultFont)
@@ -359,6 +361,10 @@ open class TextView: UITextView {
359361

360362
// MARK: - Init & deinit
361363

364+
/// Creates a Text View using the provided parameters as a base for HTML rendering.
365+
/// - Parameter defaultFont: The font to use to render the elements if no specific font is set by the HTML.
366+
/// - Parameter defaultParagraphStyle: The default paragraph style if no explicit attributes are defined in HTML
367+
/// - Parameter defaultMissingImage: The image to use if the view is not able to render an image specified in the HTML.
362368
@objc public init(
363369
defaultFont: UIFont,
364370
defaultParagraphStyle: ParagraphStyle = ParagraphStyle.default,
@@ -382,7 +388,7 @@ open class TextView: UITextView {
382388
}
383389

384390
required public init?(coder aDecoder: NSCoder) {
385-
self.defaultFont = FontProvider.shared.defaultFont
391+
defaultFont = FontProvider.shared.defaultFont
386392
defaultParagraphStyle = ParagraphStyle.default
387393
defaultMissingImage = Assets.imageIcon
388394

AztecTests/TextKit/TextViewTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1673,7 +1673,7 @@ class TextViewTests: XCTestCase {
16731673

16741674
textView.insertText("😘")
16751675
let currentTypingFont = textView.typingAttributes[.font] as! UIFont
1676-
XCTAssertEqual(currentTypingFont, font, "Font should be set to default")
1676+
XCTAssertEqual(currentTypingFont.fontDescriptor, font.fontDescriptor, "Font should be set to default")
16771677
}
16781678

16791679

0 commit comments

Comments
 (0)