You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Fonts in user library not detected in MacOS build on Github Actions #58
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.
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.
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?
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.
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?
Activity
thomasp85 commentedon Nov 16, 2020
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?
petrbouchal commentedon Nov 16, 2020
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.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:
while this does not
(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.
thomasp85 commentedon Nov 16, 2020
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
petrbouchal commentedon Nov 16, 2020
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.thomasp85 commentedon Nov 16, 2020
Let me know if you uncover anything
thomasp85 commentedon Nov 16, 2020
Can I get you to run
system_profiler SPFontsDataTypein the shell after installing the fonts and give me a link to the output?petrbouchal commentedon Nov 16, 2020
Sure - here it is, under the "install fonts and font system deps" step:
https://github.com/petrbouchal/pagetest/runs/1406528269?check_suite_focus=true
thomasp85 commentedon Nov 16, 2020
Also, can you install globally with
sudo? Don't know how permissions are handled in GHApetrbouchal commentedon Nov 16, 2020
I did try that but brew throws an error (saying brew disables itself being run as sudo.)
thomasp85 commentedon Nov 16, 2020
yeah
thomasp85 commentedon Nov 16, 2020
anyway, the
system_profilercall pretty much confirms that Plex is not being installed properly... The OS is oblivious to its existencethomasp85 commentedon Nov 16, 2020
You may want to open up an issue in brew? 🤷♂️
thomasp85 commentedon Nov 16, 2020
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
petrbouchal commentedon Nov 18, 2020
Thanks!
Thanks for checking - that was my guess from glancing at the log too.
Yes, same result with other fonts too.
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?
thomasp85 commentedon Oct 13, 2021
Have you had any luck with figuring out how to get brew fonts installed correctly on GHA?
petrbouchal commentedon Dec 17, 2022
This seems to have been resolved - fonts installed using brew now appear in the font listing and are used correctly in plot output.