-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathREADME.Rmd
95 lines (57 loc) · 2.44 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
# gfonts
<!-- badges: start -->
[![CRAN status](https://www.r-pkg.org/badges/version/gfonts)](https://CRAN.R-project.org/package=gfonts)
[![Codecov test coverage](https://codecov.io/gh/dreamRs/gfonts/branch/master/graph/badge.svg)](https://app.codecov.io/gh/dreamRs/gfonts?branch=master)
[![R-CMD-check](https://github.com/dreamRs/gfonts/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/dreamRs/gfonts/actions/workflows/R-CMD-check.yaml)
<!-- badges: end -->
> Download 'Google' fonts (via [google-webfonts-helper](https://gwfh.mranftl.com)) and generate CSS to use in [rmarkdown](https://rmarkdown.rstudio.com/) documents and [shiny](https://shiny.rstudio.com/) applications. Some popular fonts are included and ready to use.
## Installation
Install from [CRAN](https://CRAN.R-project.org/package=gfonts) with:
```r
install.packages("gfonts")
```
You can install the development version from [GitHub](https://github.com/dreamRs/gfonts) with:
```r
# install.packages("remotes")
remotes::install_github("dreamRs/gfonts")
```
## Download a font to use it locally
Get the ID of the desired font between **`r nrow(gfonts::get_all_fonts())`** available :
```{r all-fonts, eval=FALSE}
library(gfonts)
get_all_fonts()
```
Download the files necessary for its use and generate the appropriate CSS code :
```{r setup-font, eval=FALSE}
setup_font(
id = "roboto",
output_dir = "path/to"
)
```
Use it in {shiny} or {rmarkdown} :
```{r use-font, eval=FALSE}
use_font("roboto", "www/css/roboto.css")
```
:point_right: [See detailed example](https://dreamrs.github.io/gfonts/articles/gfonts.html)
## Included fonts
Some fonts are included in the package and ready to use :
```{r included-fonts, eval=FALSE}
use_pkg_gfont("roboto")
```
![](man/figures/included-fonts.png)
:point_right: [See all fonts available](https://dreamrs.github.io/gfonts/articles/articles/included-fonts.html)
## Related packages
* Package [`googlefontR`](https://github.com/timelyportfolio/googlefontR) provides helper functions to ease the use of Google Fonts with R.
* Package [`showtext`](https://github.com/yixuan/showtext) makes it easy to use various types of fonts (TrueType, OpenType, Type 1, web fonts, etc.) in R graphs.