Title: | Font Files for the 'showtext' Package |
---|---|
Description: | Providing font files that can be used by the 'showtext' package. |
Authors: | Yixuan Qiu and authors/contributors of the included fonts. See file AUTHORS for details. |
Maintainer: | Yixuan Qiu <[email protected]> |
License: | Apache License (>= 2.0) |
Version: | 3.0 |
Built: | 2024-11-04 02:47:08 UTC |
Source: | https://github.com/yixuan/showtextdb |
font_install()
saves the specified font to the ‘fonts’ directory of
the showtextdb package, so that it can be used by the showtext
package. This function requires the curl package.
font_installed()
lists fonts that have been installed to
showtextdb.
NOTE: Since the fonts are installed locally to the package directory, they will be removed every time the showtextdb package is upgraded or re-installed.
font_install(font_desc, quiet = FALSE, ...) font_installed()
font_install(font_desc, quiet = FALSE, ...) font_installed()
font_desc |
A list that provides necessary information of the font for installation. See the Details section. |
quiet |
Whether to show the progress of downloading and installation. |
... |
Other parameters passed to |
font_desc
is a list that should contain at least the following components:
showtext_name
The family name of the font that will be used in showtext.
font_ext
Extension name of the font files, e.g., ttf
for
TrueType, and otf
for OpenType.
regular_url
URL of the font file for "regular" font face.
Optionally, font_desc
can also contain bold_url
, italic_url
,
bolditalic_url
, and symbol_url
that provide the URLs of the other
font faces.
See source_han_sans()
and source_han_serif()
for an example of the font_desc
parameter.
Yixuan Qiu <https://statr.me/>
## Not run: ## Install Source Han Serif Simplified Chinese font_install(source_han_serif()) ## List available font families sysfonts::font_families() ## Use the font with the "showtext" package if(require(showtext)) { wd = setwd(tempdir()) showtext.auto() pdf("source-han-serif.pdf") par(family = "source-han-serif-cn") plot.new() box() text(0.5, 0.9, "\u601d\u6e90\u5b8b\u4f53", cex = 3, font = 2) text(0.5, 0.4, "\u843d\u5176\u5b9e\u8005\u601d\u5176\u6811", cex = 3) text(0.5, 0.2, "\u996e\u5176\u6d41\u8005\u6000\u5176\u6e90", cex = 3) dev.off() setwd(wd) } ## End(Not run)
## Not run: ## Install Source Han Serif Simplified Chinese font_install(source_han_serif()) ## List available font families sysfonts::font_families() ## Use the font with the "showtext" package if(require(showtext)) { wd = setwd(tempdir()) showtext.auto() pdf("source-han-serif.pdf") par(family = "source-han-serif-cn") plot.new() box() text(0.5, 0.9, "\u601d\u6e90\u5b8b\u4f53", cex = 3, font = 2) text(0.5, 0.4, "\u843d\u5176\u5b9e\u8005\u601d\u5176\u6811", cex = 3) text(0.5, 0.2, "\u996e\u5176\u6d41\u8005\u6000\u5176\u6e90", cex = 3) dev.off() setwd(wd) } ## End(Not run)
This function provides information of Google Fonts
that can be used in the font_install()
function.
It will try to include all font faces available for a specified family name.
google_fonts(name, ...)
google_fonts(name, ...)
name |
Name of the font that will be searched in Google Fonts. |
... |
Other parameters passed to |
Yixuan Qiu <https://statr.me/>
opensans = google_fonts("Open Sans") print(opensans) ## Not run: ## Install the Open Sans font to the showtexdb package font_install(opensans) ## End(Not run)
opensans = google_fonts("Open Sans") print(opensans) ## Not run: ## Install the Open Sans font to the showtexdb package font_install(opensans) ## End(Not run)
This function loads fonts that will be used by the showtext package.
load_showtext_fonts()
load_showtext_fonts()
Yixuan Qiu <https://statr.me/>
## Not run: sysfonts::font_families() load_showtext_fonts() sysfonts::font_families() ## End(Not run)
## Not run: sysfonts::font_families() load_showtext_fonts() sysfonts::font_families() ## End(Not run)
These functions provide information of the Source Han Sans/Serif fonts
that can be used in the font_install()
function.
Source Han Sans/Serif fonts provide complete support for the
CJK (Chinese, Japanese, and Korean) characters.
source_han_sans(lang = c("CN", "TW", "JP", "KR")) source_han_serif(lang = c("CN", "TW", "JP", "KR"))
source_han_sans(lang = c("CN", "TW", "JP", "KR")) source_han_serif(lang = c("CN", "TW", "JP", "KR"))
lang |
Language of the font. "CN" for simplified Chinese, "TW" for traditional Chinese, "JP" for Japanese, and "KR" for Korean. |
Yixuan Qiu <https://statr.me/>
## Not run: ## Install Source Han Sans font (by default Simplified Chinese) ## to the showtexdb package font_install(source_han_sans()) ## Source Han Serif Japanese font_install(source_han_serif("JP")) ## End(Not run)
## Not run: ## Install Source Han Sans font (by default Simplified Chinese) ## to the showtexdb package font_install(source_han_sans()) ## Source Han Serif Japanese font_install(source_han_serif("JP")) ## End(Not run)