get_embedded_font
returns which font is actually embedded by cairo_pdf
.
cleave
converts a delimiter separated string into a vector.
inch(x)
is equivalent to unit(x, "in")
.
is_color_invisible
tells whether the color is transparent (and hence need not be drawn).
is_color_invisible(col) get_embedded_font(font, char) inch(inches) cleave(s, sep = ",", float = FALSE, color = FALSE) file2grob(file, distort = TRUE)
col | Color |
---|---|
font | A character vector of font(s) passed to the |
char | A character vector of character(s) to be embedded by |
inches | Number representing number of inches |
s | String to convert |
sep | Delimiter (defaults to ",") |
float | If `TRUE` cast to numeric |
color | if `TRUE` convert empty strings to `"transparent"` |
file | Filename of image |
distort | Logical value of whether one should preserve the aspect ratio or distort to fit the area it is drawn in |
get_embedded_font
returns character vector of fonts that were actually embedded by cairo_pdf
.
NA
's means no embedded font detected: this either means that no font
was found or that a color emoji font was found and instead of a font an image was embedded.
get_embedded_font
depends on pdffonts
being on the system path
(on many OSes found in a poppler-utils
package).
#> [1] 6.123234e-17#> [1] 6.123234e-17#> [1] -90#> [1] 0.5cleave("0.5,0.2,0.4,0.5", float=TRUE)#> [1] 0.5 0.2 0.4 0.5cleave("black,darkred,#050EAA,,", color=TRUE)#> [1] "black" "darkred" "#050EAA" "transparent" "transparent"if ((Sys.which("pdffonts") != "") && capabilities("cairo")) { chars <- c("a", "\u2666") fonts <- c("sans", "Sans Noto", "Noto Sans", "Noto Sans Symbols2") get_embedded_font(fonts, chars) }#> char requested_font embedded_font #> 1 a sans NimbusSans-Regular #> 2 ♦ sans NimbusSans-Regular #> 3 a Sans Noto DejaVuSans #> 4 ♦ Sans Noto DejaVuSans #> 5 a Noto Sans NotoSans-Regular #> 6 ♦ Noto Sans DejaVuSans #> 7 a Noto Sans Symbols2 DejaVuSans #> 8 ♦ Noto Sans Symbols2 NotoSansSymbols2-Regularis_color_invisible("transparent")#> [1] TRUEis_color_invisible(NA)#> [1] TRUEis_color_invisible("blue")#> [1] FALSEis_color_invisible("#05AE9C")#> [1] FALSE