Skip to content

Commit

Permalink
Block surreal_text() on Windows due to the GhostScript missing the `p…
Browse files Browse the repository at this point in the history
…pm` type.
  • Loading branch information
coatless committed Sep 4, 2024
1 parent f31d585 commit 2a93103
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 0 deletions.
9 changes: 9 additions & 0 deletions R/surreal-text.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)

Expand Down
4 changes: 4 additions & 0 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down
4 changes: 4 additions & 0 deletions man/surreal_text.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 2a93103

Please sign in to comment.