Repository navigation
Closed
Description
From what I gather, with something like this — https://github.com/hrbrmstr/hrbragg/tree/master/inst/fonts/inter —
fs::dir_tree(system.file("fonts/inter", package = "hrbragg"))
## /Library/Frameworks/R.framework/Versions/4.0/Resources/library/hrbragg/fonts/inter
## ├── Inter-Black.otf
## ├── Inter-BlackItalic.otf
## ├── Inter-Bold.otf
## ├── Inter-BoldItalic.otf
## ├── Inter-ExtraBold.otf
## ├── Inter-ExtraBoldItalic.otf
## ├── Inter-ExtraLight.otf
## ├── Inter-ExtraLightItalic.otf
## ├── Inter-Italic.otf
## ├── Inter-Light.otf
## ├── Inter-LightItalic.otf
## ├── Inter-Medium.otf
## ├── Inter-MediumItalic.otf
## ├── Inter-Regular.otf
## ├── Inter-SemiBold.otf
## ├── Inter-SemiBoldItalic.otf
## ├── Inter-Thin.otf
## └── Inter-ThinItalic.otfin a package, to get the equivalent of this:
# A tibble: 18 x 9
path index name family style weight width italic monospace
<chr> <int> <chr> <chr> <chr> <ord> <ord> <lgl> <lgl>
1 /Users/hrbrmstr/Library/Fonts/Inter-ExtraL… 0 Inter-ExtraLight Inter Extra Light light norm… FALSE FALSE
2 /Users/hrbrmstr/Library/Fonts/Inter-Bold.o… 0 Inter-Bold Inter Bold bold norm… FALSE FALSE
3 /Users/hrbrmstr/Library/Fonts/Inter-Italic… 0 Inter-Italic Inter Italic normal norm… TRUE FALSE
4 /Users/hrbrmstr/Library/Fonts/Inter-ExtraB… 0 Inter-ExtraBold Inter Extra Bold ultrabo… norm… FALSE FALSE
5 /Users/hrbrmstr/Library/Fonts/Inter-Regula… 0 Inter-Regular Inter Regular normal norm… FALSE FALSE
6 /Users/hrbrmstr/Library/Fonts/Inter-Medium… 0 Inter-MediumItalic Inter Medium Italic medium norm… TRUE FALSE
7 /Users/hrbrmstr/Library/Fonts/Inter-ExtraL… 0 Inter-ExtraLightI… Inter Extra Light It… light norm… TRUE FALSE
8 /Users/hrbrmstr/Library/Fonts/Inter-ExtraB… 0 Inter-ExtraBoldIt… Inter Extra Bold Ita… ultrabo… norm… TRUE FALSE
9 /Users/hrbrmstr/Library/Fonts/Inter-Black.… 0 Inter-Black Inter Black heavy norm… FALSE FALSE
10 /Users/hrbrmstr/Library/Fonts/Inter-SemiBo… 0 Inter-SemiBoldIta… Inter Semi Bold Ital… semibold norm… TRUE FALSE
11 /Users/hrbrmstr/Library/Fonts/Inter-LightI… 0 Inter-LightItalic Inter Light Italic normal norm… TRUE FALSE
12 /Users/hrbrmstr/Library/Fonts/Inter-Light.… 0 Inter-Light Inter Light normal norm… FALSE FALSE
13 /Users/hrbrmstr/Library/Fonts/Inter-Thin.o… 0 Inter-Thin Inter Thin ultrali… norm… FALSE FALSE
14 /Users/hrbrmstr/Library/Fonts/Inter-ThinIt… 0 Inter-ThinItalic Inter Thin Italic ultrali… norm… TRUE FALSE
15 /Users/hrbrmstr/Library/Fonts/Inter-SemiBo… 0 Inter-SemiBold Inter Semi Bold semibold norm… FALSE FALSE
16 /Users/hrbrmstr/Library/Fonts/Inter-BlackI… 0 Inter-BlackItalic Inter Black Italic heavy norm… TRUE FALSE
17 /Users/hrbrmstr/Library/Fonts/Inter-Medium… 0 Inter-Medium Inter Medium medium norm… FALSE FALSE
18 /Users/hrbrmstr/Library/Fonts/Inter-BoldIt… 0 Inter-BoldItalic Inter Bold Italic bold norm… TRUE FALSE
in an R session registry, I'd have to deal with the individual registrations for the various weights. Is there any way with the new underlying tooling to specify another search path or have a registration function that just takes a path and registers all the fonts in that directory?
Reacted by M. Foos, Petr Bouchal and Cédric Scherer
Metadata
Metadata
Assignees
Labels
No labels
Activity
thomasp85 commentedon Feb 21, 2021
There is no way to add a path that would be treated equally as the fonts installed in the system. I can see a good reason for some path scanning functionality however so let me think about the right API
statnmap commentedon Nov 17, 2021
Would it be possible to add a function that helps installing the font in the correct user directory instead ?
I mean, if I have a custom font in my package and I want users to install the font on their system, instead of only registering it for the session, currently I will ask them to do it manually. But, that would be nice if a R function could install it directly from command line.
This would also simplify CI integration I guess.
It seems that {extrafont} will hardly be maintained now (https://github.com/wch/Rttf2pt1)
Maybe we can retrieve this function that list all possible user font directories.
I think that this is a little different from what can currently return {systemfonts} because this requires the directory to already exist.
Below is the code that list system fonts directories, even if they do not exist for now. I guess that we can limit this to writable directories as the aim is to be able to copy a ttf directory into one of these like:
Retrieved from: https://github.com/wch/extrafont/blob/054a41fcba237cbb693144a0fc7b23a9e30f0c2b/R/truetype.r#L125
In which, I would add
thomasp85 commentedon Jan 16, 2025
This is now possible using
add_fonts(). Further, systemfonts will automatically scan./fontsand~/fontsand add any font that resides there