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

More explicit message when caching a google font #141

Merged
merged 6 commits into from
Apr 24, 2024
Merged

Conversation

hadley
Copy link
Member

@hadley hadley commented Apr 23, 2024

Opened mostly to start discussion about what the preferred interface is — I assumed that you'll usually be downloading multiple files for a single font but you'll only want to be informed once. Let me know if there's something different that you'd prefer.

@hadley hadley requested a review from cpsievert April 23, 2024 22:13
R/fonts.R Outdated
@@ -441,7 +443,12 @@ font_dep_google_local <- function(x) {
x$cache$remove(css_key)
return(font_dep_google_local(x))
}
download_file(url, f)
if (!informed) {
rlang::inform(paste0("Downloading google font ", x$family, " to local cache"))
Copy link
Contributor

@cpsievert cpsievert Apr 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately, the to local cache part isn't always true.

x$cache can be a "mock" cache that never actually caches. I think, to workaround this, it could make sense for resolve_cache() to return something like a mock_cache = TRUE field here which we'd then use for check when constructing the message.

Also, when a cache isn't a mock cache, I suppose it could also make sense to include x$cache$dir() in the message (so the user knows where those files are going)?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let me know if these changes are what you are thinking.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I went ahead and made the change I was thinking of in cbfd605. Once I have your 👍 , I'll merge.

NEWS.md Outdated Show resolved Hide resolved
@hadley
Copy link
Member Author

hadley commented Apr 24, 2024

I'm pretty sure the build failure is unrelated to this PR.

@cpsievert cpsievert merged commit 9228fcf into main Apr 24, 2024
14 of 15 checks passed
@cpsievert cpsievert deleted the font-inform branch April 24, 2024 19:05
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.

None yet

2 participants