0

Can I increase the size or width of a line?

For example, the below is wrapped after the second 'a', and I'd like it all to be on one line.

#install.packages("Rfiglet")
library(Rfiglet)


figlet('starwars', 
        respect.linebreaks = FALSE,
        smush = TRUE,
        font = "starwars")
     _______.___________.    ___      .______     ____    __    ____  ___      
    /       |           |   /   \     |   _  \    \   \  /  \  /   / /   \     
   |   (----`---|  |----`  /  ^  \    |  |_)  |    \   \/    \/   / /  ^  \    
    \   \       |  |      /  /_\  \   |      /      \            / /  /_\  \   
.----)   |      |  |     /  _____  \  |  |\  \----.  \    /\    / /  _____  \  
|_______/       |__|    /__/     \__\ | _| `._____|   \__/  \__/ /__/     \__\ 
                                                                               
.______          _______.
|   _  \        /       |
|  |_)  |      |   (----`
|      /        \   \    
|  |\  \----.----)   |   
| _| `._____|_______/  

options(width = 999) didn't change anything.

dca
  • 594
  • 4
  • 18

1 Answers1

1

Deciding if the text has to be printed in 1 line or 2 line is decided from figlet function internally most probably based on number of characters in the input.

figlet function returns a character vector, we can achieve what we want by using a hack. When the output is spread across 2 lines we can combine the two lines using paste and change the class back to 'figlet'.

library(Rfiglet)
tmp <- figlet('starwars', 
       respect.linebreaks = TRUE,
       smush = FALSE,
       font = "starwars")

n <- length(tmp)
tmp1 <- paste(tmp[1:(n/2)], tmp[(n/2 + 1):n])
class(tmp1) <- 'figlet'
tmp1
     _______..___________.    ___      .______     ____    __    ____       ___      .______           _______.
    /       ||           |   /   \     |   _  \    \   \  /  \  /   /      /   \     |   _  \         /       |
   |   (----``---|  |----`  /  ^  \    |  |_)  |    \   \/    \/   /      /  ^  \    |  |_)  |       |   (----`
    \   \        |  |      /  /_\  \   |      /      \            /      /  /_\  \   |      /         \   \    
.----)   |       |  |     /  _____  \  |  |\  \----.  \    /\    /      /  _____  \  |  |\  \----..----)   |   
|_______/        |__|    /__/     \__\ | _| `._____|   \__/  \__/      /__/     \__\ | _| `._____||_______/  
Ronak Shah
  • 377,200
  • 20
  • 156
  • 213
  • That works for the simple case. There are extra spaces in between the W and the A...at the line break. Also, I guess this won't work generically...across x number of lines. – dca Aug 24 '20 at 23:00