From 18ce5ffb64834896400d3a47eae8c5871bea006c Mon Sep 17 00:00:00 2001 From: Yihui Xie Date: Thu, 19 Sep 2024 17:02:13 -0500 Subject: [PATCH] use cairo by default for bitmap devices if possible (rstudio/rmarkdown#2561) --- NEWS.md | 2 ++ R/fuse.R | 8 ++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/NEWS.md b/NEWS.md index fc574b0..ab2961c 100644 --- a/NEWS.md +++ b/NEWS.md @@ -2,6 +2,8 @@ - Added back/forward/refresh/print buttons to the toolbar in the `litedown::roam()` preview interface. +- Set `options(bitmapType = 'cairo')` in `fuse()` if `capabilities('cairo')` is TRUE, which will generate smaller bitmap plot files (e.g., `.png`) than using `quartz` or `Xlib`, and is also a safer option for `fuse()` to be executed in parallel (rstudio/rmarkdown#2561). + # CHANGES IN litedown VERSION 0.2 - A data frame (or matrix/tibble) wrapped in `I()` is fully printed to a table now by default. Without `I()`, data objects are truncated to 10 rows by default when printing to tables. diff --git a/R/fuse.R b/R/fuse.R index a79f929..670a821 100644 --- a/R/fuse.R +++ b/R/fuse.R @@ -528,8 +528,12 @@ fiss = function(input, output = '.R', text = NULL) { ) message('Quitting from ', get_loc(nms[k])) } - # suppress tidyverse progress bars - opt = options(rstudio.notebook.executing = TRUE) + # suppress tidyverse progress bars and use cairo for bitmap devices (for + # smaller plot files and possible parallel execution) + opt = options( + rstudio.notebook.executing = TRUE, + bitmapType = if (capabilities('cairo')) 'cairo' else .Options$bitmapType + ) on.exit({ options(opt); on_error() }, add = TRUE) # the chunk option `order` determines the execution order of chunks