Create an HTML span of the unicode zero-width character
Source:R/ggplot2-annotations.R
zerowidth_char.Rd
Helper function for adjusting paragraph margins for use with ggtext/gridtext, which does not natively support margin/padding styles.
Details
The zero-width unicode character only ever takes up vertical space, so when placed in-line its size determines the amount of "top-margins" for the paragraph. This allows finer control over spacing.
Examples
# \dontrun{
library(ggtext)
ggplot() +
geom_richtext(aes(0, 0, label = "This is a line<br><br>This is a paragraph<br>of text."))
ggplot() +
geom_richtext(aes(0, 0, label = paste0(
"This is a line<br>",
zerowidth_char(30),
"This is a paragraph<br>of text."
)))
#> Warning: unable to translate '<U+200B>agg_png122.5' to native encoding
#> Warning: unable to translate '<U+200B>agg_png122.5' to native encoding
# }