@@ -247,6 +247,20 @@ check_device = function(feature, action = "warn", op = NULL, maybe = FALSE,
247
247
dev_name <- names(dev_cur )
248
248
}
249
249
250
+ # {ragg} and {svglite} report capabilities, but need specific version
251
+ if (dev_name %in% c(" agg_jpeg" , " agg_ppm" , " agg_png" , " agg_tiff" )) {
252
+ check_installed(
253
+ " ragg" , version = " 1.2.6" ,
254
+ reason = paste0(" for checking device support for " , feat_name , " ." )
255
+ )
256
+ }
257
+ if (dev_name == " devSVG" ) {
258
+ check_installed(
259
+ " svglite" , version = " 2.1.2" ,
260
+ reason = paste0(" for checking device support for " , feat_name , " ." )
261
+ )
262
+ }
263
+
250
264
# For blending/compositing, maybe test a specific operation
251
265
if (! is.null(op ) && feature %in% c(" blending" , " compositing" )) {
252
266
op <- arg_match0(op , c(.blend_ops , .compo_ops ))
@@ -305,34 +319,8 @@ check_device = function(feature, action = "warn", op = NULL, maybe = FALSE,
305
319
}
306
320
}
307
321
308
- # Test {ragg}'s capabilities
309
- if (dev_name %in% c(" agg_jpeg" , " agg_ppm" , " agg_png" , " agg_tiff" )) {
310
- # We return ragg's version number if not installed, so we can suggest to
311
- # install it.
312
- capable <- switch (
313
- feature ,
314
- clippingPaths = , alpha_masks = , gradients = ,
315
- patterns = if (is_installed(" ragg" , version = " 1.2.0" )) TRUE else " 1.2.0" ,
316
- FALSE
317
- )
318
- if (isTRUE(capable )) {
319
- return (TRUE )
320
- }
321
- if (is.character(capable ) && action != " test" ) {
322
- check_installed(
323
- " ragg" , version = capable ,
324
- reason = paste0(" for graphics support of " , feat_name , " ." )
325
- )
326
- }
327
- action_fun(paste0(
328
- " The {.pkg ragg} package's {.field {dev_name}} device does not support " ,
329
- " {.emph {feat_name}}."
330
- ), call = call )
331
- return (FALSE )
332
- }
333
-
334
- # The vdiffr version of the SVG device is known to not support any newer
335
- # features
322
+ # If vdiffr has neither confirmed nor denied its capabilities, the feature
323
+ # is assumed to be not supported.
336
324
if (dev_name == " devSVG_vdiffr" ) {
337
325
action_fun(
338
326
" The {.pkg vdiffr} package's device does not support {.emph {feat_name}}." ,
@@ -341,33 +329,6 @@ check_device = function(feature, action = "warn", op = NULL, maybe = FALSE,
341
329
return (FALSE )
342
330
}
343
331
344
- # The same logic applies to {svglite} but is tested separately in case
345
- # {ragg} and {svglite} diverge at some point.
346
- if (dev_name == " devSVG" ) {
347
- # We'll return a version number if not installed so we can suggest it
348
- capable <- switch (
349
- feature ,
350
- clippingPaths = , gradients = , alpha_masks = ,
351
- patterns = if (is_installed(" svglite" , version = " 2.1.0" )) TRUE else " 2.1.0" ,
352
- FALSE
353
- )
354
-
355
- if (isTRUE(capable )) {
356
- return (TRUE )
357
- }
358
- if (is.character(capable ) && action != " test" ) {
359
- check_installed(
360
- " svglite" , version = capable ,
361
- reason = paste0(" for graphics support of " , feat_name , " ." )
362
- )
363
- }
364
- action_fun(paste0(
365
- " The {.pkg {pkg}} package's {.field {dev_name}} device does not " ,
366
- " support {.emph {feat_name}}." ), call = call
367
- )
368
- return (FALSE )
369
- }
370
-
371
332
# Last resort: list of known support prior to R 4.2.0
372
333
supported <- c(" pdf" , " cairo_pdf" , " cairo_ps" , " svg" )
373
334
if (feature == " compositing" ) {
0 commit comments