SimonFairbairn / SwiftyMarkdown

Converts Markdown files and strings into NSAttributedStrings with lots of customisation options.
MIT License
1.64k stars 275 forks source link

Bold font size get's overridden by fontDescriptor #109

Open bensLine opened 3 years ago

bensLine commented 3 years ago

When using a custom font (e.g. SourceSansPro-Bold.ttf) and configuring it as markdown.bold with custom font size 16 the library returns the font with size 12.

It turned out that font size 16 get's overwridden by the font descriptor in SwiftyMarkdown+iOS.swift:

if globalBold, let boldDescriptor = font.fontDescriptor.withSymbolicTraits(.traitBold) {
     font = UIFont(descriptor: boldDescriptor, size: 0)
}

I'd expect that the library respects the configured font size 16 and does not overwrite it.

Cheers and thanks for the library!