In order to do correct text rendering, the font needed must be figured out. A
common case is rendering of emojis within a string where the system emoji
font is used rather than the requested font. This function will inspect the
provided strings and split them up in runs that must be rendered with the
emoji font, and the rest. Arguments are recycled to the length of the string
vector.
str_split_emoji(
string,
family = "",
italic = FALSE,
bold = FALSE,
path = NULL,
index = 0
)
A data.frame containing the following columns:
The substring containing a consecutive run of glyphs
The index into the original string
vector that the substring is part of
A logical vector giving if the substring is a run of emojis or not
emoji_string <- "This is a joke\U0001f642. It should be obvious from the smiley"
str_split_emoji(emoji_string)
#> # A tibble: 3 × 3
#> string id emoji
#> <chr> <dbl> <lgl>
#> 1 This is a joke 1 FALSE
#> 2 🙂 1 TRUE
#> 3 . It should be obvious from the smiley 1 FALSE