gonzalezreal / swift-markdown-ui

Display and customize Markdown text in SwiftUI
MIT License
2.25k stars 268 forks source link

Custom font not working #105

Closed raulvbrito closed 1 year ago

raulvbrito commented 2 years ago

I'm trying to use custom fonts but can't get it to work. It always renders a system default font (Helvetica). I've tried the following solutions so far:

Markdown(viewModel.text).markdownStyle(
    MarkdownStyle(
        font: MarkdownStyle.Font.custom("CustomFont-Bold", size: 16.0)
    )
)
Markdown(viewModel.text).markdownStyle(
    MarkdownStyle(
        font: MarkdownStyle.Font.custom("CustomFont", size: 16.0)
    )
)
Markdown(viewModel.text)
    .font(.custom("CustomFont", size: 16.0).bold())
Markdown(viewModel.text)
    .font(.custom("CustomFont-Bold", size: 16.0))
gonzalezreal commented 2 years ago

Hi @raulvbrito, Sorry for the late response. Does your custom fonts work with the Text view? I am just asking to make sure the issue is not related to properly adding and registering custom fonts to your application.

raulvbrito commented 1 year ago

Hi @gonzalezreal, yes the custom font is applied to any Text inside my app

gonzalezreal commented 1 year ago

Hi @raulvbrito, The fix for this issue will be part of the next release. Thanks for reporting.

raulvbrito commented 1 year ago

Thank you so much @gonzalezreal ! I'll be testing it as soon as the release is out