Pulp 1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
pulp::canvas::AttributedString Class Reference

Attributed string — a sequence of styled text spans. More...

#include <attributed_string.hpp>

Public Member Functions

 AttributedString ()=default
 AttributedString (std::string text)
void append (std::string text)
 Append plain text with default styling.
void append (TextSpan span)
 Append a fully styled span.
void append (std::string text, Color color)
 Append text with specific color.
void append (std::string text, float font_size, Color color)
 Append text with specific font size and color.
const std::vector< TextSpan > & spans () const
 Get all spans.
std::string plain_text () const
 Get the full plain text (concatenated).
size_t length () const
 Total character count.
bool empty () const
 Whether empty.
void clear ()
 Clear all spans.
void set_font (std::string family, float size)
 Set font for all spans.
void set_color (Color color)
 Set color for all spans.

Detailed Description

Attributed string — a sequence of styled text spans.

Constructor & Destructor Documentation

◆ AttributedString() [1/2]

pulp::canvas::AttributedString::AttributedString ( )
default

◆ AttributedString() [2/2]

pulp::canvas::AttributedString::AttributedString ( std::string text)
inlineexplicit

Member Function Documentation

◆ append() [1/4]

void pulp::canvas::AttributedString::append ( std::string text)
inline

Append plain text with default styling.

◆ append() [2/4]

void pulp::canvas::AttributedString::append ( std::string text,
Color color )
inline

Append text with specific color.

◆ append() [3/4]

void pulp::canvas::AttributedString::append ( std::string text,
float font_size,
Color color )
inline

Append text with specific font size and color.

◆ append() [4/4]

void pulp::canvas::AttributedString::append ( TextSpan span)
inline

Append a fully styled span.

◆ clear()

void pulp::canvas::AttributedString::clear ( )
inline

Clear all spans.

◆ empty()

bool pulp::canvas::AttributedString::empty ( ) const
inline

Whether empty.

◆ length()

size_t pulp::canvas::AttributedString::length ( ) const
inline

Total character count.

◆ plain_text()

std::string pulp::canvas::AttributedString::plain_text ( ) const
inline

Get the full plain text (concatenated).

◆ set_color()

void pulp::canvas::AttributedString::set_color ( Color color)
inline

Set color for all spans.

◆ set_font()

void pulp::canvas::AttributedString::set_font ( std::string family,
float size )
inline

Set font for all spans.

◆ spans()

const std::vector< TextSpan > & pulp::canvas::AttributedString::spans ( ) const
inline

Get all spans.


The documentation for this class was generated from the following file: