Reduce code block font point sizes by 10% on the new attributed string builder.

This commit is contained in:
Stefan Ceriu
2025-09-16 12:34:40 +03:00
committed by Stefan Ceriu
parent f8cca30164
commit cf9df8a8e1
5 changed files with 11 additions and 8 deletions
@@ -174,7 +174,10 @@ struct AttributedStringBuilderV2: AttributedStringBuilderProtocol {
case "code", "pre":
let preserveFormatting = preserveFormatting || tag == "pre"
content = attributedString(element: childElement, documentBody: documentBody, preserveFormatting: preserveFormatting, listTag: listTag, listIndex: &childIndex, indentLevel: indentLevel)
let fontPointSize = fontPointSize * 0.9 // Intentionally shrink code blocks by 10%
content.setFontPreservingSymbolicTraits(UIFont.monospacedSystemFont(ofSize: fontPointSize, weight: .regular))
content.addAttribute(.CodeBlock, value: true, range: NSRange(location: 0, length: content.length))
content.addAttribute(.backgroundColor, value: UIColor.compound._bgCodeBlock as Any, range: NSRange(location: 0, length: content.length))