Open petrbouchal opened 4 years ago
Hi - I just tried installing IBM Plex via brew locally and everything works as it should, so the issue is certainly related to running this in GHA. Maybe the issue is that your R session is not running under the same user as the font installation was? Do you know if it is possible through brew to specify that the font should be installed globally?
Hi,
many thanks for investigating. System-wide font install is possible but fails on GHA because of permissions.
I ran Sys.info()
and it seems R is running on the same user under which the fonts are installed.
## sysname
## "Darwin"
## release
## "19.6.0"
## version
## "Darwin Kernel Version 19.6.0: Thu Oct 29 22:56:45 PDT 2020; root:xnu-6153.141.2.2~1/RELEASE_X86_64"
## nodename
## "Mac-1605518904509.local"
## machine
## "x86_64"
## login
## "root"
## user
## "runner"
## effective_user
## "runner"
What is odd is that {systemfonts} can access the font files in /Users/runner/Library/Fonts via register_font()
(and these are inside the same user home dir as the working directory) but does not see that as a font dir when looking up fonts.
Also, in case this is helpful, this works:
systemfonts::register_font("IBM Plex Sans Condensed 2",
plain = '/Users/runner/Library/Fonts/IBMPlexSansCondensed-Regular.otf')
while this does not
systemfonts::register_font("IBM Plex Sans Condensed 2",
plain = '~/Library/Fonts/IBMPlexSansCondensed-Regular.otf')
(It runs without error but the device cannot find the font later.)
I understand this might not be solvable inside systemfonts but might merit a bit of documentation somewhere, perhaps in a future vignette or in the ragg vignettes.
Dang - I had hoped this was a matter of switching user between font install and running R...
systemfonts is using CoreText from the macOS API to figure out font locations and really don't care where they are located... Since this works locally it is not a matter of CoreText not being able to find user fonts, but must be some interaction between that API and the GHA setup. In any regards this is unsolvable from systemfonts... registration should always work as long as there is sufficient permissions on the system
Sorry, this was not the answer you were hoping for
Thanks - frankly that was my assumption from the beginning: that there is something opaque around the GHA setup. Happy to use the solution based on import_fonts()
unless I figure out what the problem is in the GHA setup.
Let me know if you uncover anything
Can I get you to run system_profiler SPFontsDataType
in the shell after installing the fonts and give me a link to the output?
Sure - here it is, under the "install fonts and font system deps" step: https://github.com/petrbouchal/pagetest/runs/1406528269?check_suite_focus=true
Also, can you install globally with sudo
? Don't know how permissions are handled in GHA
I did try that but brew throws an error (saying brew disables itself being run as sudo.)
yeah
anyway, the system_profiler
call pretty much confirms that Plex is not being installed properly... The OS is oblivious to its existence
You may want to open up an issue in brew? 🤷♂️
Also, maybe try out with another brew font and see if it is a general issue with brew fonts on GHA, or specific to the Plex formula
Thanks!
anyway, the system_profiler call pretty much confirms that Plex is not being installed properly... The OS is oblivious to its existence
Thanks for checking - that was my guess from glancing at the log too.
Also, maybe try out with another brew font and see if it is a general issue with brew fonts on GHA, or specific to the Plex formula
Yes, same result with other fonts too.
You may want to open up an issue in brew?
I wonder if I can narrow this down between brew, the cask formula, and the GHA runner. When you say that the font is not being installed properly, do you have an idea about what else needs to happen for the font to be installed besides the file landing in the right directory?
Have you had any luck with figuring out how to get brew fonts installed correctly on GHA?
This seems to have been resolved - fonts installed using brew now appear in the font listing and are used correctly in plot output.
The problem: on a MacOS build on Github Actions, {systemfonts} does not see fonts installed in user library, reports matching IBM Plex Sans to Helvetica but some other font shows up in the ggplot2 PNG ragg output.
This may well be a limitation of Github Actions (or me doing something wrong in the workflow spec), but logging here in case (a) it can be remedied in {systemfonts} or (b) you have any intuitions as to whether/how it can be handled on the GHA side.
HTML output at https://petrbouchal.xyz/pagetest/ (ignore text...) Worflow file at https://github.com/petrbouchal/pagetest/blob/master/.github/workflows/website.yml Workflow output at https://github.com/petrbouchal/pagetest/runs/1400625372?check_suite_focus=true Rmd code at https://github.com/petrbouchal/pagetest/blob/master/index.Rmd
What I try to do:
rmarkdown::render_site()
, containing {ggplot2} graphics using the fontdev = "ragg_png"
.What I expect:
What I see:
systemfonts::system_fonts()
contains only entries with paths starting in /System/Library/Fontssystemfonts::match_font("IBM Plex Sans")
returns Helvetica.Feeding the font in manually via
systemfonts::register_font()
works but that is a bit of a convoluted and long-winded solution - but it confirms that the user font library exists and is accessible to R.