The hardware and bandwidth for this mirror is donated by dogado GmbH, the Webhosting and Full Service-Cloud Provider. Check out our Wordpress Tutorial.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]dogado.de.

Type: Package
Title: Font Files for the 'showtext' Package
Version: 3.0
Date: 2020-05-31
Author: Yixuan Qiu and authors/contributors of the included fonts. See file AUTHORS for details.
Maintainer: Yixuan Qiu <yixuan.qiu@cos.name>
Description: Providing font files that can be used by the 'showtext' package.
Imports: sysfonts (≥ 0.7), utils
Suggests: curl
License: Apache License (≥ 2.0)
Copyright: see file COPYRIGHTS
RoxygenNote: 7.1.0
NeedsCompilation: no
Packaged: 2020-06-04 04:05:01 UTC; qyx
Repository: CRAN
Date/Publication: 2020-06-04 08:10:02 UTC

Install Fonts to the 'showtextdb' Package

Description

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.

Usage

font_install(font_desc, quiet = FALSE, ...)

font_installed()

Arguments

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 curl::curl_download().

Details

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.

Author(s)

Yixuan Qiu <https://statr.me/>

Examples

## 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)

Meta-information for the Google Fonts

Description

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.

Usage

google_fonts(name, ...)

Arguments

name

Name of the font that will be searched in Google Fonts.

...

Other parameters passed to curl::curl_fetch_memory().

Author(s)

Yixuan Qiu <https://statr.me/>

Examples

opensans = google_fonts("Open Sans")
print(opensans)

## Not run: 
## Install the Open Sans font to the showtexdb package
font_install(opensans)

## End(Not run)

Load Fonts for the 'showtext' Package

Description

This function loads fonts that will be used by the showtext package.

Usage

load_showtext_fonts()

Author(s)

Yixuan Qiu <https://statr.me/>

Examples

## Not run: 
sysfonts::font_families()

load_showtext_fonts()
sysfonts::font_families()

## End(Not run)

Meta-information for the Source Han Sans/Serif Fonts

Description

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.

Usage

source_han_sans(lang = c("CN", "TW", "JP", "KR"))

source_han_serif(lang = c("CN", "TW", "JP", "KR"))

Arguments

lang

Language of the font. "CN" for simplified Chinese, "TW" for traditional Chinese, "JP" for Japanese, and "KR" for Korean.

Author(s)

Yixuan Qiu <https://statr.me/>

Examples

## 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)

These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.
Health stats visible at Monitor.