Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing dynamic type for custom fonts #314

Conversation

mikelikespie
Copy link
Contributor

@mikelikespie mikelikespie commented May 8, 2024

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.

@erator
Copy link

erator commented May 16, 2024

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

@gonzalezreal
Copy link
Owner

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

@mikelikespie
Copy link
Contributor Author

mikelikespie commented Jun 17, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants