org.cosplay.CPFIGLetFont
See theCPFIGLetFont companion object
class CPFIGLetFont(flfPath: String) extends CPFont
FIGLet font.
FIGLet fonts allow creating art text out of ordinary letters, for example:
/$$$$$$ /$$$$$$$ /$$ /$$__ $$ | $$__ $$| $$ | $$ \__/ /$$$$$$ /$$$$$$$| $$ \ $$| $$ /$$$$$$ /$$ /$$ | $$ /$$__ $$ /$$_____/| $$$$$$$/| $$ |____ $$| $$ | $$ | $$ | $$ \ $$| $$$$$$ | $$____/ | $$ /$$$$$$$| $$ | $$ | $$ $$| $$ | $$ \____ $$| $$ | $$ /$$__ $$| $$ | $$ | $$$$$$/| $$$$$$/ /$$$$$$$/| $$ | $$| $$$$$$$| $$$$$$$ \______/ \______/ |_______/ |__/ |__/ \_______/ \____ $$ ___ _____ ___ ____ __ __ _ _ /$$ | $$ / __)( _ )/ __)( _ \( ) /__\ ( \/ ) | $$$$$$/ ( (__ )(_)( \__ \ )___/ )(__ /(__)\ \ / \______/ \___)(_____)(___/(__) (____)(__)(__)(__) ,, .g8"""bgd `7MM"""Mq.`7MM .dP' `M MM `MM. MM dM' ` ,pW"Wq. ,pP"Ybd MM ,M9 MM ,6"Yb.`7M' `MF' MM 6W' `Wb 8I `" MMmmdM9 MM 8) MM VA ,V MM. 8M M8 `YMMMa. MM MM ,pm9MM VA ,V `Mb. ,'YA. ,A9 L. I8 MM MM 8M MM VVV `"bmmmd' `Ybmd9' M9mmmP'.JMML. .JMML.`Moo9^Yo. ,V ,V OOb"
You can read the full FIGLet specification here. This class provides relatively full implementation for FIGLet fonts with the following limitations:
- code tags are NOT supported
- only UTF-8 and windows-1252 charsets are supported
- only left-to-right font direction is supported
- vertical smushing iS NOT supported (ignored)
CosPlay comes with 277 built-in pre-packaged FIGLet fonts. Companion object for this class contains constants for all these fonts.
Here's an example of rendering FIGLet fonts using static image sprites. Note that when invoking render it returns an image that can be rendered or used just like any other image in CosPlay:
val spr1 = CPStaticImageSprite(30, 14, 4, FIG_OGRE.render("CosPlay", C_WHITE).trimBg())
val spr1 = CPStaticImageSprite(30, 20, 4, FIG_OGRE.withKerning().render("CosPlay", C_LIGHT_STEEL_BLUE).trimBg())
val spr1 = CPStaticImageSprite(30, 27, 4, FIG_OGRE.withFullWidth().render("CosPlay", C_LIGHT_CORAL).trimBg())
Here's the list of helpful links when working with FIGLet fonts:
- http://www.figlet.org - Linux/Unix FIGLet utility.
- http://www.jave.de/figlet/figfont.html - full specification for FIGLet font.
- https://patorjk.com/software/taag - convenient online tester for various FIGLet fonts.
Attributes
- Example
-
See CPFontsExample source code for an example of FIGLet font functionality.
- Companion
- object
- Source
- CPFIGLetFont.scala
- Graph
-
- Supertypes
Members list
In this article