Text on the matrix: chars and strings in the font, standing or shifting in.
More...
#include <Text.h>
|
|
| 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 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.
|
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.
◆ 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] | panel | The panel to draw on. |
- Returns
- True while the char or the space after it is still shifting.
◆ SetChar()
Draws a char with its top left corner at x, y.
What lies off the panel is left out.
- Parameters
-
| [in,out] | panel | The panel to draw on. |
| [in] | x | The column of the left edge; it may lie off the panel. |
| [in] | y | The row of the top edge; it may lie off the panel. |
| [in] | c | The char, latin-1. |
- Returns
- Error::kOk, or Error::kUnknownChar if the font has no char for it; nothing is drawn then.
◆ SetCharWithShift()
Starts shifting a char in from the right, until it stands at the right edge.
- Parameters
-
- Returns
- Error::kOk, or Error::kUnknownChar if the font has no sprite for the char; nothing starts then.
◆ SetFont()
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] | font | The 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] | panel | The panel to draw on. |
| [in] | x | The column of the left edge; it may lie off the panel. |
| [in] | y | The row of the top edge; it may lie off the panel. |
| [in] | glyph | The 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_chars | The 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] | panel | The panel to draw on. |
| [in] | x | The column of the left edge; it may lie off the panel. |
| [in] | y | The row of the top edge; it may lie off the panel. |
| [in] | sprite | The sprite. |
◆ SetText()
Draws a text from the left edge, as far as it fits.
- Parameters
-
| [in,out] | panel | The panel to draw on. |
| [in] | text | The 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()
Starts shifting a text in from the right, until its last char stands at the right edge, or over and over.
- Parameters
-
| [in] | text | The 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] | repeat | True 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] | panel | The panel to draw on. |
- Returns
- True while the text is still shifting.
The documentation for this class was generated from the following file: