showtext_auto {showtext}R Documentation

Automatically Using 'showtext' for New Graphics Devices

Description

The two versions of this function are equivalent, but the "underscore" naming is preferred.

This function could turn on/off the automatic use of showtext functionality. If turned on, any newly opened graphics devices will use showtext to draw text. This helps to avoid the repeated calls of showtext_begin() and showtext_end().

Usage

showtext_auto(enable = TRUE, record = TRUE)

showtext.auto(enable = TRUE, record = TRUE)

Arguments

enable

TRUE to turn on and FALSE to turn off.

record

If TRUE, then showtext_begin() is added to the display list of the current graphics device (via recordGraphics()), so that it may be "replayed" at a later time point (via replayPlot()).

Author(s)

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

See Also

showtext_begin(), showtext_end()

Examples

## Not run: 
pdf("test1.pdf")
plot(1, main = "\u6b22\u8fce")  ## may not render properly
dev.off()

## Automatically use showtext for future devices
showtext_auto()
plot(1, main = "\u6b22\u8fce", family = "wqy-microhei")

pdf("test2.pdf")
plot(1, main = "\u6b22\u8fce", family = "wqy-microhei")
dev.off()

## Turn off if needed
showtext_auto(FALSE)

## End(Not run)

[Package showtext version 0.9-7 Index]