org.cosplay.CPStyledString
See theCPStyledString companion object Builder for a styled string rendered using system font.
This utility class provides a builder pattern to built styled (colored) strings that
are rendered using a system font . Once styled string is built it can be
rendered via CPCanvas.drawStyledString method.
Here's an example of using styled string together with array image to quickly
create an image with a styled textual content:
import CPStyledString.styleStr
val lblImg = new CPArrayImage(
styleStr("[SPACE]", C_WHITE) ++ styleStr("Play|Pause ", C_GREEN) ++
styleStr("[R]", C_WHITE) ++ styleStr("Rewind ", C_GREEN) ++
styleStr("[Q]", C_WHITE) ++ styleStr("Quit ", C_GREEN) ++
styleStr("[CTRL-L]", C_WHITE) ++ styleStr("Log ", C_GREEN) ++
styleStr("[CTRL-Q]", C_WHITE) ++ styleStr("FPS Overlay", C_GREEN)
).trimBg()
Attributes See also: Example: See CPFontsExample source code for an
example of font functionality.
Companion: object Source: CPStyledString.scala Graph Reset zoom Hide graph Show graph
Supertypes class Object
trait Matchable
class Any
Members list Concise view
Value members
Creates styled string with no background.
Creates styled string with no background.
Attributes fgColor Foreground color.
s String.
Source: CPStyledString.scala
Sets current background color.
Sets current background color.
Attributes bg Background color to set. Use None
to remove background color.
Source: CPStyledString.scala
Sets current background color.
Finalizes this styled string and renders it into sequence of pixels .
Clears this styled string.
Sets current foreground color.
Sets current foreground and background colors.
Sets current foreground and background colors.
Attributes bg Background color to set. Use None
to remove background color.
fg Foreground color to set.
Source: CPStyledString.scala
Sets current foreground and background colors.
Sets current foreground and background colors.
Attributes bg Background color to set.
fg Foreground color to set.
Source: CPStyledString.scala
Adds given object string representation to this style string using current foreground and
background colors.
Adds given object string representation to this style string using current foreground and
background colors.
Attributes obj Object to add.
Source: CPStyledString.scala