MaxMatrix
Drive chained 8x8 LED dot matrix modules with MAX7219.
Loading...
Searching...
No Matches
max_matrix::internal::Text Class Reference

Text on the matrix: chars and strings in the font, standing or shifting in. More...

#include <Text.h>

Public Member Functions

 Text ()
 Makes a text with nothing to shift.
MAXMATRIX_NODISCARD uint8_t GetSpaceBetweenChars () const
 Returns the empty columns between two chars of a text.
MAXMATRIX_NODISCARD span< uint8_t const > GetFont () const
 Returns the font every char is drawn in.
MAXMATRIX_NODISCARD Status SetFont (span< uint8_t const > font)
 Sets the font every char is drawn in from now on.
MAXMATRIX_NODISCARD Status SetChar (Panel &panel, int16_t x, int16_t y, char c) const
 Draws a char with its top left corner at x, y.
MAXMATRIX_NODISCARD Status SetCharWithShift (char c)
 Starts shifting a char in from the right, until it stands at the right edge.
MAXMATRIX_NODISCARD Status SetText (Panel &panel, span< char const > text) const
 Draws a text from the left edge, as far as it fits.
MAXMATRIX_NODISCARD Status SetTextWithShift (span< char const > text, bool repeat)
 Starts shifting a text in from the right, until its last char stands at the right edge, or over and over.
void SetSpaceBetweenChars (uint8_t space_between_chars)
 Sets the empty columns between two chars of a text.
bool CharShiftTask (Panel &panel)
 Shifts the char one column further.
bool StringShiftTask (Panel &panel)
 Shifts the text one column further.

Static Public Member Functions

static void SetSprite (Panel &panel, int16_t x, int16_t y, Sprite const &sprite)
 Draws a sprite with its top left corner at x, y.
static void SetGlyph (Panel &panel, int16_t x, int16_t y, Glyph const &glyph)
 Draws a glyph of a font with its top left corner at x, y.

Detailed Description

Text on the matrix: chars and strings in the font, standing or shifting in.

Every function that draws is given the panel it draws on. A text shifts in from the right, one column per call of CharShiftTask() or StringShiftTask(), which Matrix::ShiftTask() makes.

Member Function Documentation

◆ CharShiftTask()

bool max_matrix::internal::Text::CharShiftTask ( Panel & panel)

Shifts the char one column further.

Called by Matrix::ShiftTask(), or by StringShiftTask() for each char of a text, until it returns false.

Parameters
[in,out]panelThe panel to draw on.
Returns
True while the char or the space after it is still shifting.

◆ SetChar()

MAXMATRIX_NODISCARD Status max_matrix::internal::Text::SetChar ( Panel & panel,
int16_t x,
int16_t y,
char c ) const

Draws a char with its top left corner at x, y.

What lies off the panel is left out.

Parameters
[in,out]panelThe panel to draw on.
[in]xThe column of the left edge; it may lie off the panel.
[in]yThe row of the top edge; it may lie off the panel.
[in]cThe char, latin-1.
Returns
Error::kOk, or Error::kUnknownChar if the font has no char for it; nothing is drawn then.

◆ SetCharWithShift()

MAXMATRIX_NODISCARD Status max_matrix::internal::Text::SetCharWithShift ( char c)

Starts shifting a char in from the right, until it stands at the right edge.

Parameters
[in]cThe char, latin-1.
Returns
Error::kOk, or Error::kUnknownChar if the font has no sprite for the char; nothing starts then.

◆ SetFont()

MAXMATRIX_NODISCARD Status max_matrix::internal::Text::SetFont ( span< uint8_t const > font)

Sets the font every char is drawn in from now on.

A char that shifts in already goes on in the font it started in.

Parameters
[in]fontThe font, in flash, in the format Font describes.
Returns
Error::kOk, or Error::kNotAFont if Font::CheckFont() does not take it; the font then stays as it was.

◆ SetGlyph()

void max_matrix::internal::Text::SetGlyph ( Panel & panel,
int16_t x,
int16_t y,
Glyph const & glyph )
static

Draws a glyph of a font with its top left corner at x, y.

What lies off the panel is left out.

Parameters
[in,out]panelThe panel to draw on.
[in]xThe column of the left edge; it may lie off the panel.
[in]yThe row of the top edge; it may lie off the panel.
[in]glyphThe glyph, its columns in flash.

◆ SetSpaceBetweenChars()

void max_matrix::internal::Text::SetSpaceBetweenChars ( uint8_t space_between_chars)

Sets the empty columns between two chars of a text.

Parameters
[in]space_between_charsThe number of empty columns.

◆ SetSprite()

void max_matrix::internal::Text::SetSprite ( Panel & panel,
int16_t x,
int16_t y,
Sprite const & sprite )
static

Draws a sprite with its top left corner at x, y.

What lies off the panel is left out.

Parameters
[in,out]panelThe panel to draw on.
[in]xThe column of the left edge; it may lie off the panel.
[in]yThe row of the top edge; it may lie off the panel.
[in]spriteThe sprite.

◆ SetText()

MAXMATRIX_NODISCARD Status max_matrix::internal::Text::SetText ( Panel & panel,
span< char const > text ) const

Draws a text from the left edge, as far as it fits.

Parameters
[in,out]panelThe panel to draw on.
[in]textThe text, UTF-8 or latin-1, up to its terminating null character or the end of the span.
Returns
Error::kOk; Error::kNoText if text is an empty span; or Error::kUnknownChar if the font lacks a char of the text, with the chars before it drawn.

◆ SetTextWithShift()

MAXMATRIX_NODISCARD Status max_matrix::internal::Text::SetTextWithShift ( span< char const > text,
bool repeat )

Starts shifting a text in from the right, until its last char stands at the right edge, or over and over.

Parameters
[in]textThe text, UTF-8 or latin-1, up to its terminating null character or the end of the span. It is kept as a span, so it has to live until the text stands, or as long as it starts over.
[in]repeatTrue to start over with the first char after the last, without end.
Returns
Error::kOk, or Error::kNoText if text is an empty span; nothing starts then.

◆ StringShiftTask()

bool max_matrix::internal::Text::StringShiftTask ( Panel & panel)

Shifts the text one column further.

Called by Matrix::ShiftTask() until it returns false.

Parameters
[in,out]panelThe panel to draw on.
Returns
True while the text is still shifting.

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