swift-markdown-ui icon indicating copy to clipboard operation
swift-markdown-ui copied to clipboard

Fixing dynamic type for custom fonts

Open mikelikespie opened this issue 1 year ago • 1 comments
trafficstars

Right now it seems the library accounts for dynamic type twice when using custom fonts.

This is because it is using the @ScaledMetric for dynamic size, as well as custom(_ name: String, size: CGFloat) constructor for Font. The docs for that one say

    /// Create a custom font with the given `name` and `size` that scales with
    /// the body text style.

Which means its scales it again.

It seems like the easiest fix is just calling the other constructor for custom fonts which has a fixedSize parameter. It appears that all the versions required in Package.swift support that constructor.

mikelikespie avatar May 08 '24 02:05 mikelikespie

@mikelikespie have you tried looking into the failing test testFontWithProperties()?

erator avatar May 16 '24 05:05 erator

@mikelikespie I cherry-picked your change and fixed the failing test #330. Thanks for the contribution!

gonzalezreal avatar Jun 16 '24 08:06 gonzalezreal

Thanks so much! APologies for not fixin the test, it got lost in my todos

On Sun, Jun 16, 2024 at 1:38 AM Guille Gonzalez @.***> wrote:

@mikelikespie https://github.com/mikelikespie I cherry-picked your change and fixed the failing test #330 https://github.com/gonzalezreal/swift-markdown-ui/pull/330. Thanks for the contribution!

— Reply to this email directly, view it on GitHub https://github.com/gonzalezreal/swift-markdown-ui/pull/314#issuecomment-2171253031, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAFHOY6UDU6D23KI3RJE7LZHVFHBAVCNFSM6AAAAABHMCODT2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNZRGI2TGMBTGE . You are receiving this because you were mentioned.Message ID: @.***>

mikelikespie avatar Jun 17 '24 01:06 mikelikespie