-
Notifications
You must be signed in to change notification settings - Fork 327
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
Recent change to dynamic scaling broke themes that use custom fonts #337
Comments
cc: @gonzalezreal |
Sorry, I am currently unavailable. I can look into this in a couple of weeks. |
@gonzalezreal Hi! Have you got any time to look into this yet? I could open a PR to fix it, but since that would just be a revert of this PR, I'm not sure how to proceed. |
Hi @gemigkaka, |
Hi @mustiikhalil & @gemigkaka, Sorry for taking so long to look into this. Thanks for your patience :) The code introduced in #314 is correct, as previously the dynamic type scale was applied twice. The issue with the code you have provided in the description is that you are using an absolute point size for the font in the swift-markdown-ui/Sources/MarkdownUI/Theme/TextStyle/Styles/FontSize.swift Lines 24 to 37 in 5544181
Before #314 this was working for your use case because the scale was being incorrectly applied twice. If you remove the custom paragraph style from the custom theme in the description, you will see that the paragraph text scales properly while the heading text doesn't, because the The recommended way of adjusting the font size for the different block and text styles is to use a relative size, either based on the parent font size ( The following theme scales the text properly when changing the dynamic type: extension Theme {
static let myTheme = Theme()
.heading3 { config in
config.label
.markdownTextStyle {
FontFamily(.custom("trebuchet MS"))
FontWeight(.semibold)
FontSize(.em(1.5))
}
}
.text {
FontFamily(.custom("menlo"))
FontSize(16)
}
} I am closing this issue as the library is behaving as expected. |
Hello,
Thanks for maintaining this library. We are facing an issue with the dynamic text scaling and custom fonts whenever we try to use the library after the latest update 2.3.1. In the latest release there is this following PR that adjusts the use of "setting the dynamic text twice". As seen below in the images the when using the
markdownTheme
in the green box it doesnt change the size of the text while the user is changing the text size.The project:
We use the following SwiftUI view as an example:
Theme:
Screenshots:
Default Sized text:
When user sets text bigger:
Screenshots from 2.3.0:
Default Sized text:
When user sets text bigger:
The text was updated successfully, but these errors were encountered: