From 2a93103b91edbc4badc3aa3dec2389fe2f8754e2 Mon Sep 17 00:00:00 2001 From: James J Balamuta Date: Wed, 4 Sep 2024 00:28:21 -0700 Subject: [PATCH] Block surreal_text() on Windows due to the GhostScript missing the `ppm` type. --- R/surreal-text.R | 9 +++++++++ README.Rmd | 4 ++++ README.md | 5 +++++ man/surreal_text.Rd | 4 ++++ 4 files changed, 22 insertions(+) diff --git a/R/surreal-text.R b/R/surreal-text.R index ccc6f6a..08ff7cd 100644 --- a/R/surreal-text.R +++ b/R/surreal-text.R @@ -106,6 +106,10 @@ process_image <- function(image) { #' @return #' A data.frame containing the results of the surreal method application. #' +#' @details +#' This function is not supported on Windows due to the `ppm` image format +#' not being supported by the version of GhostScript included with R. +#' #' @examples #' # Create a surreal plot of the text "R is fun" appearing on one line #' r_is_fun_result <- surreal_text("R is fun", verbose = TRUE) @@ -124,6 +128,11 @@ surreal_text <- function(text = "hello world", n_add_points = 40, max_iter = 100, tolerance = 0.01, verbose = FALSE) { + if (.Platform$OS.type == "windows") { + message("This function is not supported on Windows.") + return(NULL) + } + # Create temporary plot of the text temp_file <- temporary_text_plot(text = text, cex = cex) diff --git a/README.Rmd b/README.Rmd index 6549016..a3f5ac4 100644 --- a/README.Rmd +++ b/README.Rmd @@ -98,6 +98,10 @@ The residual plot reveals the original R logo with a slight border, enhancing th ## Creating Custom Hidden Images +> [!IMPORTANT] +> +> This function is unable to work on Windows as the version of GhostScript included with R does not support the `ppm` type. + You can also create datasets with custom hidden images or text. Here's a quick example using text: ```{r} diff --git a/README.md b/README.md index 9a9ebb0..8850e9e 100644 --- a/README.md +++ b/README.md @@ -100,6 +100,11 @@ enhancing the image recovery. ## Creating Custom Hidden Images +> \[!IMPORTANT\] +> +> This function is unable to work on Windows as the version of +> GhostScript included with R does not support the `ppm` type. + You can also create datasets with custom hidden images or text. Here’s a quick example using text: diff --git a/man/surreal_text.Rd b/man/surreal_text.Rd index 7ee6bfa..e4919f1 100644 --- a/man/surreal_text.Rd +++ b/man/surreal_text.Rd @@ -40,6 +40,10 @@ This function applies the surreal method to a text string. It first creates a temporary plot with the text, processes the image, and then applies the surreal method to the data. } +\details{ +This function is not supported on Windows due to the \code{ppm} image format +not being supported by the version of GhostScript included with R. +} \examples{ # Create a surreal plot of the text "R is fun" appearing on one line r_is_fun_result <- surreal_text("R is fun", verbose = TRUE)