rfiglet.Rmd
__ _ _ _ _
_ __ / _(_) __ _| | ___| |_| |
| '__| |_| |/ _` | |/ _ \ __| |
| | | _| | (_| | | __/ |_|_|
|_| |_| |_|\__, |_|\___|\__(_)
|___/
rfiglet is a pure-R implementation of FIGlet (Frank, Ian and Glenn’s letters) a classic system for creating text banners in many fonts.
The core of the package is the rfiglet::figlet
function, which renders a string in a figlet font (by default standard
)
rfiglet::figlet("Hello world!")
#> _ _ _ _ _ _ _
#> | | | | ___| | | ___ __ _____ _ __| | __| | |
#> | |_| |/ _ \ | |/ _ \ \ \ /\ / / _ \| '__| |/ _` | |
#> | _ | __/ | | (_) | \ V V / (_) | | | | (_| |_|
#> |_| |_|\___|_|_|\___/ \_/\_/ \___/|_| |_|\__,_(_)
There are 18 bundled fonts, representing the standard figlet font library
rfiglet::figlet_font_list()
#> [1] "banner" "big" "block" "bubble" "digital" "ivrit"
#> [7] "lean" "mini" "mnemonic" "script" "shadow" "slant"
#> [13] "small" "smscript" "smshadow" "smslant" "standard" "term"
Pass the name of the font to rfiglet::figlet
to use it
rfiglet::figlet("Hello shadow!", font = "shadow")
#> | | | | | | |
#> | | _ \ | | _ \ __| __ \ _` | _` | _ \\ \ \ / |
#> ___ | __/ | | ( | \__ \ | | | ( | ( | ( |\ \ \ / _|
#> _| _|\___|_|_|\___/ ____/_| |_|\__,_|\__,_|\___/ \_/\_/ _)
There are many more fonts available, and these can be downloaded by running
path <- rfiglet::figlet_download_fonts()
#> Downloading fonts to '/Users/runner/Library/Application Support/org.R-project.R/R/rfiglet'
This will download all the extra fonts to wherever RFIGLET_FONT_DIR
points, falling back on the cache directory tools::R_user_dir("rfiglet", "data"
in R 4.0.0 or higher
dir(path)
#> [1] "1943.flf" "1row.flf" "3-d.flf"
#> [4] "3d_diagonal.flf" "3x5.flf" "4max.flf"
#> [7] "4x4_offr.flf" "5lineoblique.flf" "5x7.flf"
#> [10] "5x8.flf" "64f1.flf" "6x10.flf"
#> [13] "6x9.flf" "a_zooloo.flf" "acrobatic.flf"
#> [16] "advenger.flf" "alligator.flf" "alligator2.flf"
#> [19] "alligator3.flf" "alpha.flf" "alphabet.flf"
#> [22] "amc3line.flf" "amc3liv1.flf" "amcaaa01.flf"
#> [25] "amcneko.flf" "amcrazo2.flf" "amcrazor.flf"
#> [28] "amcslash.flf" "amcslder.flf" "amcthin.flf"
#> [31] "amctubes.flf" "amcun1.flf" "aquaplan.flf"
#> [34] "arrows.flf" "asc.flf" "ascii_new_roman.flf"
#> [37] "ascii.flf" "ascii12.tlf" "ascii9.tlf"
#> [40] "assalt_m.flf" "asslt__m.flf" "atc_gran.flf"
#> [43] "atc.flf" "avatar.flf" "b_m__200.flf"
#> [46] "B1FF.flf" "banner.flf" "banner3-D.flf"
#> [49] "banner3.flf" "banner4.flf" "barbwire.flf"
#> [52] "basic.flf" "battle_s.flf" "battlesh.flf"
#> [55] "baz__bil.flf" "bear.flf" "beer_pub.flf"
#> [58] "bell.flf" "benjamin.flf" "bigascii12.tlf"
#> [61] "bigascii9.tlf" "bigchief.flf" "bigfig.flf"
#> [64] "bigmono12.tlf" "bigmono9.tlf" "binary.flf"
#> [67] "blocks.flf" "bolger.flf" "braced.flf"
#> [70] "bright.flf" "brite.flf" "briteb.flf"
#> [73] "britebi.flf" "britei.flf" "broadway_kb.flf"
#> [76] "broadway.flf" "bubble_b.flf" "bubble.flf"
#> [79] "bulbhead.flf" "c_ascii.flf" "c_consen.flf"
#> [82] "c1.flf" "c2.flf" "calgphy2.flf"
#> [85] "caligraphy.flf" "cards.flf" "catwalk.flf"
#> [88] "caus_in.flf" "char1.flf" "char2.flf"
#> [91] "char3.flf" "char4.flf" "charact1.flf"
#> [94] "charact2.flf" "charact3.flf" "charact4.flf"
#> [97] "charact5.flf" "charact6.flf" "characte.flf"
#> [100] "charset.flf" "chartr.flf" "chartri.flf"
#> [103] "chiseled.flf" "chunky.flf" "circle.tlf"
#> [106] "clb6x10.flf" "clb8x10.flf" "clb8x8.flf"
#> [109] "cli8x8.flf" "clr4x6.flf" "clr5x10.flf"
#> [112] "clr5x6.flf" "clr5x8.flf" "clr6x10.flf"
#> [115] "clr6x6.flf" "clr6x8.flf" "clr7x10.flf"
#> [118] "clr7x8.flf" "clr8x10.flf" "clr8x8.flf"
#> [121] "cns.flf" "coil_cop.flf" "coinstak.flf"
#> [124] "cola.flf" "colossal.flf" "com_sen.flf"
#> [127] "computer.flf" "contessa.flf" "contrast.flf"
#> [130] "convoy.flf" "cosmic.flf" "cosmike.flf"
#> [133] "cour.flf" "courb.flf" "courbi.flf"
#> [136] "couri.flf" "crawford.flf" "crazy.flf"
#> [139] "cricket.flf" "cursive.flf" "cyberlarge.flf"
#> [142] "cybermedium.flf" "cybersmall.flf" "cygnet.flf"
#> [145] "d_dragon.flf" "DANC4.flf" "dancingfont.flf"
#> [148] "dcs_bfmo.flf" "decimal.flf" "deep_str.flf"
#> [151] "defleppard.flf" "demo_1.flf" "demo_2.flf"
#> [154] "demo_m.flf" "devilish.flf" "diamond.flf"
#> [157] "dietcola.flf" "doh.flf" "doom.flf"
#> [160] "dosrebel.flf" "dotmatrix.flf" "double.flf"
#> [163] "doubleshorts.flf" "drpepper.flf" "druid.flf"
#> [166] "dwhistled.flf" "e__fist.flf" "ebbs_1.flf"
#> [169] "ebbs_2.flf" "eca.flf" "eftichess.flf"
#> [172] "eftifont.flf" "eftipiti.flf" "eftirobot.flf"
#> [175] "eftitalic.flf" "eftiwall.flf" "eftiwater.flf"
#> [178] "emboss.tlf" "emboss2.tlf" "epic.flf"
#> [181] "etcrvs.flf" "f15.flf" "faces_of.flf"
#> [184] "fair_mea.flf" "fairligh.flf" "fantasy.flf"
#> [187] "fbr_stri.flf" "fbr_tilt.flf" "fbr1.flf"
#> [190] "fbr12.flf" "fbr2.flf" "fender.flf"
#> [193] "filter.flf" "finalass.flf" "fire_font-k.flf"
#> [196] "fire_font-s.flf" "fireing.flf" "flipped.flf"
#> [199] "flowerpower.flf" "flyn_sh.flf" "fourtops.flf"
#> [202] "fp1.flf" "fp2.flf" "fraktur.flf"
#> [205] "funface.flf" "funfaces.flf" "funky_dr.flf"
#> [208] "future_1.flf" "future_2.flf" "future_3.flf"
#> [211] "future_4.flf" "future_5.flf" "future_6.flf"
#> [214] "future_7.flf" "future_8.flf" "future.tlf"
#> [217] "fuzzy.flf" "gauntlet.flf" "gb16fs.flf"
#> [220] "gb16st.flf" "georgi16.flf" "Georgia11.flf"
#> [223] "ghost_bo.flf" "ghost.flf" "ghoulish.flf"
#> [226] "glenyn.flf" "goofy.flf" "gothic.flf"
#> [229] "graceful.flf" "gradient.flf" "graffiti.flf"
#> [232] "grand_pr.flf" "greek.flf" "green_be.flf"
#> [235] "hades.flf" "hanglg16.flf" "hanglm16.flf"
#> [238] "heart_left.flf" "heart_right.flf" "heavy_me.flf"
#> [241] "helv.flf" "helvb.flf" "helvbi.flf"
#> [244] "helvi.flf" "henry3d.flf" "heroboti.flf"
#> [247] "hex.flf" "hieroglyphs.flf" "high_noo.flf"
#> [250] "hills.flf" "hollywood.flf" "home_pak.flf"
#> [253] "horizontalleft.flf" "horizontalright.flf" "house_of.flf"
#> [256] "hypa_bal.flf" "hyper.flf" "ICL-1900.flf"
#> [259] "impossible.flf" "inc_raw.flf" "invita.flf"
#> [262] "isometric1.flf" "isometric2.flf" "isometric3.flf"
#> [265] "isometric4.flf" "italic.flf" "italics.flf"
#> [268] "jacky.flf" "jazmine.flf" "jerusalem.flf"
#> [271] "jiskan16.flf" "joust.flf" "katakana.flf"
#> [274] "kban.flf" "keyboard.flf" "kgames_i.flf"
#> [277] "kik_star.flf" "knob.flf" "konto.flf"
#> [280] "kontoslant.flf" "krak_out.flf" "l4me.flf"
#> [283] "larry3d.flf" "lazy_jon.flf" "lcd.flf"
#> [286] "letter_w.flf" "letter.tlf" "letters.flf"
#> [289] "letterw3.flf" "lexible.flf" "lildevil.flf"
#> [292] "lineblocks.flf" "linux.flf" "lockergnome.flf"
#> [295] "mad_nurs.flf" "madrid.flf" "magic_ma.flf"
#> [298] "marquee.flf" "master_o.flf" "maxfour.flf"
#> [301] "mayhem_d.flf" "mcg.flf" "merlin1.flf"
#> [304] "merlin2.flf" "mig_ally.flf" "mike.flf"
#> [307] "mirror.flf" "modern.flf" "modular.flf"
#> [310] "mono12.tlf" "mono9.tlf" "morse.flf"
#> [313] "morse2.flf" "moscow.flf" "mshebrew210.flf"
#> [316] "muzzle.flf" "nancyj-fancy.flf" "nancyj-improved.flf"
#> [319] "nancyj-underlined.flf" "nancyj.flf" "new_asci.flf"
#> [322] "nfi1.flf" "nipples.flf" "notie_ca.flf"
#> [325] "npn.flf" "nscript.flf" "ntgreek.flf"
#> [328] "nvscript.flf" "o8.flf" "octal.flf"
#> [331] "odel_lak.flf" "ogre.flf" "ok_beer.flf"
#> [334] "oldbanner.flf" "os2.flf" "outrun.flf"
#> [337] "p_s_h_m.flf" "p_skateb.flf" "pacos_pe.flf"
#> [340] "pagga.tlf" "panther.flf" "pawn_ins.flf"
#> [343] "pawp.flf" "peaks.flf" "peaksslant.flf"
#> [346] "pebbles.flf" "pepper.flf" "phonix.flf"
#> [349] "platoon.flf" "platoon2.flf" "pod.flf"
#> [352] "poison.flf" "puffy.flf" "puzzle.flf"
#> [355] "pyramid.flf" "r2-d2.flf" "rad_phan.flf"
#> [358] "rad.flf" "radical.flf" "rainbow.flf"
#> [361] "rally_s2.flf" "rally_sp.flf" "rammstein.flf"
#> [364] "rampage.flf" "rastan.flf" "raw_recu.flf"
#> [367] "rci.flf" "rebel.tlf" "rectangles.flf"
#> [370] "red_phoenix.flf" "relief.flf" "relief2.flf"
#> [373] "rev.flf" "reverse.flf" "ripper!.flf"
#> [376] "road_rai.flf" "rockbox.flf" "rok.flf"
#> [379] "roman.flf" "rot13.flf" "rotated.flf"
#> [382] "rounded.flf" "rowancap.flf" "rozzo.flf"
#> [385] "runic.flf" "runyc.flf" "s-relief.flf"
#> [388] "sans.flf" "sansb.flf" "sansbi.flf"
#> [391] "sansi.flf" "santaclara.flf" "sblood.flf"
#> [394] "sbook.flf" "sbookb.flf" "sbookbi.flf"
#> [397] "sbooki.flf" "script.flf" "serifcap.flf"
#> [400] "shimrod.flf" "short.flf" "skate_ro.flf"
#> [403] "skateord.flf" "skateroc.flf" "sketch_s.flf"
#> [406] "slide.flf" "slscript.flf" "sm.flf"
#> [409] "smallcaps.flf" "smascii12.tlf" "smascii9.tlf"
#> [412] "smblock.tlf" "smbraille.tlf" "smisome1.flf"
#> [415] "smkeyboard.flf" "smmono12.tlf" "smmono9.tlf"
#> [418] "smpoison.flf" "smtengwar.flf" "soft.flf"
#> [421] "space_op.flf" "spc_demo.flf" "speed.flf"
#> [424] "spliff.flf" "stacey.flf" "stampate.flf"
#> [427] "stampatello.flf" "star_war.flf" "starstrips.flf"
#> [430] "starwars.flf" "stealth.flf" "stellar.flf"
#> [433] "stencil1.flf" "stencil2.flf" "stforek.flf"
#> [436] "stop.flf" "straight.flf" "street_s.flf"
#> [439] "sub-zero.flf" "subteran.flf" "super_te.flf"
#> [442] "swampland.flf" "swan.flf" "sweet.flf"
#> [445] "t__of_ap.flf" "tanja.flf" "tav1.flf"
#> [448] "taxi.flf" "tec_7000.flf" "tec1.flf"
#> [451] "tecrvs.flf" "tengwar.flf" "test1.flf"
#> [454] "thick.flf" "thin.flf" "threepoint.flf"
#> [457] "ti_pan.flf" "ticks.flf" "ticksslant.flf"
#> [460] "tiles.flf" "times.flf" "timesofl.flf"
#> [463] "tinker-toy.flf" "tomahawk.flf" "tombstone.flf"
#> [466] "top_duck.flf" "train.flf" "trashman.flf"
#> [469] "trek.flf" "triad_st.flf" "ts1.flf"
#> [472] "tsalagi.flf" "tsm.flf" "tsn_base.flf"
#> [475] "tty.flf" "ttyb.flf" "tubular.flf"
#> [478] "twin_cob.flf" "twisted.flf" "twopoint.flf"
#> [481] "type_set.flf" "ucf_fan.flf" "ugalympi.flf"
#> [484] "unarmed.flf" "univers.flf" "usa_pq.flf"
#> [487] "usa.flf" "usaflag.flf" "utopia.flf"
#> [490] "utopiab.flf" "utopiabi.flf" "utopiai.flf"
#> [493] "varsity.flf" "vortron.flf" "war_of_w.flf"
#> [496] "wavy.flf" "weird.flf" "wetletter.flf"
#> [499] "whimsy.flf" "wideterm.tlf" "wow.flf"
#> [502] "xbrite.flf" "xbriteb.flf" "xbritebi.flf"
#> [505] "xbritei.flf" "xchartr.flf" "xchartri.flf"
#> [508] "xcour.flf" "xcourb.flf" "xcourbi.flf"
#> [511] "xcouri.flf" "xhelv.flf" "xhelvb.flf"
#> [514] "xhelvbi.flf" "xhelvi.flf" "xsans.flf"
#> [517] "xsansb.flf" "xsansbi.flf" "xsansi.flf"
#> [520] "xsbook.flf" "xsbookb.flf" "xsbookbi.flf"
#> [523] "xsbooki.flf" "xtimes.flf" "xtty.flf"
#> [526] "xttyb.flf" "yie_ar_k.flf" "yie-ar.flf"
#> [529] "z-pilot.flf" "zig_zag.flf" "zone7.flf"
Once downloaded you can reference these fonts by name (i.e., filename without the extension)
rfiglet::figlet("Extra!", font = "acrobatic.flf")
#> o__ __o__/_ o o
#> <| v <|> <|>
#> < > < > / \
#> | \o o/ | \o__ __o o__ __o/ \o/
#> o__/_ v\ /v o__/_ | |> /v | |
#> | <\/> | / \ < > /> / \ < >
#> <o> o/\o | \o/ \ \o/
#> | /v v\ o | o | o
#> / \ _\o__/_ /> <\ <\__ / \ <\__ / \ _<|>_
Some degree of layout conrol is available via the arguments justify
and width
, powered by R’s strwrap
and format
options. By default lines are broken at the width of your terminal (getOption("width")
) but you can override this.
If a string is too long it will be wrapped to fit:
rfiglet::figlet("A quick brown fox", width = 45)
#> _ _ _
#> / \ __ _ _ _(_) ___| | __
#> / _ \ / _` | | | | |/ __| |/ /
#> / ___ \ | (_| | |_| | | (__| <
#> /_/ \_\ \__, |\__,_|_|\___|_|\_\
#> | |__ _ __ __|_| ___ __
#> | '_ \| '__/ _ \ \ /\ / / '_ \
#> | |_) | | | (_) \ V V /| | | |
#> |_.__/|_| \___/ \_/\_/ |_| |_|
#> __
#> / _| _____ __
#> | |_ / _ \ \/ /
#> | _| (_) > <
#> |_| \___/_/\_\
You can align the fragments relative to each other using justify
:
rfiglet::figlet("A quick brown fox", width = 45, justify = "centre")
#> _ _ _
#> / \ __ _ _ _(_) ___| | __
#> / _ \ / _` | | | | |/ __| |/ /
#> / ___ \ | (_| | |_| | | (__| <
#> /_/_ \_\ \__, |\__,_|_|\___|_|\_\
#> | |__ _ __ |_|__ ___ __
#> | '_ \| '__/ _ \ \ /\ / / '_ \
#> | |_) | | | (_) \ V V /| | | |
#> |_.__/|_| _\___/ \_/\_/ |_| |_|
#> / _| _____ __
#> | |_ / _ \ \/ /
#> | _| (_) > <
#> |_| \___/_/\_\
Or relative to the entire width by adding absolute = TRUE
rfiglet::figlet("A quick brown fox", width = 45, justify = "centre",
absolute = TRUE)
#> _ _ _
#> / \ __ _ _ _(_) ___| | __
#> / _ \ / _` | | | | |/ __| |/ /
#> / ___ \ | (_| | |_| | | (__| <
#> /_/_ \_\ \__, |\__,_|_|\___|_|\_\
#> | |__ _ __ |_|__ ___ __
#> | '_ \| '__/ _ \ \ /\ / / '_ \
#> | |_) | | | (_) \ V V /| | | |
#> |_.__/|_| _\___/ \_/\_/ |_| |_|
#> / _| _____ __
#> | |_ / _ \ \/ /
#> | _| (_) > <
#> |_| \___/_/\_\
The latter option is more obvious with a longer width or shorter text
rfiglet::figlet("right", justify = "right", absolute = TRUE)
#> _ _ _
#> _ __(_) __ _| |__ | |_
#> | '__| |/ _` | '_ \| __|
#> | | | | (_| | | | | |_
#> |_| |_|\__, |_| |_|\__|
#> |___/