-
Notifications
You must be signed in to change notification settings - Fork 17
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
register_fonts()
work in interactive session, but not inside a package
#103
Comments
I'm having a similar problem with my The onLoad <- function(libname, pkgname) {
systemfonts::register_font(
name = "Headline 360info",
plain = system.file("extdata", "LibreFranklin-Black.ttf",
package = "themes360info"))
systemfonts::register_font(
name = "Subhead 360info",
plain = system.file("extdata", "LibreFranklin-Bold.ttf",
package = "themes360info"))
systemfonts::register_font(
name = "Body 360info",
plain = system.file("extdata", "LibreFranklin-Light.ttf",
package = "themes360info"),
italic = system.file("extdata", "LibreFranklin-LightItalic.ttf",
package = "themes360info"),
bold = system.file("extdata", "LibreFranklin-Bold.ttf",
package = "themes360info"),
bolditalic = system.file("extdata", "LibreFranklin-BoldItalic.ttf",
package = "themes360info"))
}
When I macOS Session Info> sessionInfo() R version 4.2.2 (2022-10-31) Platform: aarch64-apple-darwin20 (64-bit) Running under: macOS Ventura 13.2.1Matrix products: default locale: attached base packages: other attached packages: loaded via a namespace (and not attached): But plots give me:
Or the same if I use
I've also tested in a rocker container based on ggplot(mtcars) + aes(mpg, hp) + geom_point() + theme_minimal(18, "Headline 360info") |
@alesvomacka It seems your issue is not with the font registry as such but with the check functionality not using ragg/svglite and thus not being able to find the registered fonts (if you inspect the error message you'll see that it mentions postscript font database) I'm afraid there is not much I can do about how postscript looks for fonts |
@jimjam-slam I think this is a different issue. Am I understanding it correctly that |
@thomasp85 Oops, I was wrong—it works fine on a Linux dev container but doesn't work on macOS. I might need to do some more work to isolate the problem! |
Hi,
I'm trying to include a custom font inside my package and register it on load using the
register_fonts()
function. I'm registering the font using this code:In an interactive session, this works flawlessly, e.g. running this works:
However, when I try using the above mentioned snippet in
.onLoad()
, the font won't import properly:This leads to the following error when trying to run
devtools::check()
, once the check tries to run example code:I would be grateful for any advice. Thanks!
Session info:
The text was updated successfully, but these errors were encountered: