MaxMatrix
Drive chained 8x8 LED dot matrix modules with MAX7219.
Loading...
Searching...
No Matches
Font.h
Go to the documentation of this file.
1// Copyright 2020 Andreas Burnickl
2// SPDX-License-Identifier: GPL-3.0-or-later
3
11
12#ifndef MAXMATRIX_SRC_FONT_FONT_H_
13#define MAXMATRIX_SRC_FONT_FONT_H_
14
15#include "Arduino.h"
16#include "MaxMatrixAttributes.h"
17#include "MaxMatrixError.h"
19#include "Utility/array.h"
20#include "Utility/span.h"
21
22namespace max_matrix {
23
25constexpr uint8_t kSpriteMaxWidth{5};
27constexpr uint16_t kDefaultFontSize{614};
28
45
53
54namespace internal {
55
63constexpr bool IsEndOfText(span<char const> text, size_t position) {
64 return position >= text.size() || text[position] == kNullCharacter;
65}
66
67} // namespace internal
68
71 char c;
72 uint8_t length;
73};
74
83// Declared here, the constant data in the .cpp: no static initializer to run.
84// NOLINTNEXTLINE(bugprone-dynamic-static-initializers)
86
158
159} // namespace max_matrix
160
161#endif // MAXMATRIX_SRC_FONT_FONT_H_
array< uint8_t, kDefaultFontSize > const kDefaultFont
The font MaxMatrix starts with: ASCII from the space to the tilde, the German umlauts,...
constexpr uint8_t kSpriteMaxWidth
Definition Font.h:25
constexpr bool IsEndOfText(span< char const > text, size_t position)
Returns whether a text has ended at position: at its terminating null character, or at the end of its...
Definition Font.h:63
constexpr uint16_t kDefaultFontSize
Definition Font.h:27
The attributes of a later standard, as macros, where the compiler has them.
#define MAXMATRIX_NODISCARD
Marks a function whose result must not be dropped: the compiler warns where it is.
Definition MaxMatrixAttributes.h:37
Why a call did not do what it was asked.
The values of a switch of the configuration, and the end of a text.
constexpr char kNullCharacter
Definition MaxMatrixStandardTypes.h:22
A C array that knows its size, as std::array, and make_array(), which takes the size from the values.
The format of a font, and the way from a char of a string to its glyph.
Definition Font.h:119
static MAXMATRIX_NODISCARD Result< Glyph > GetGlyph(span< uint8_t const > font, char c)
Finds the glyph of a char in a font.
static DecodedChar DecodeChar(span< char const > text)
Decodes the next char of a string.
static MAXMATRIX_NODISCARD Status CheckFont(span< uint8_t const > font)
Returns whether font is a font that fills its bytes exactly.
What a getter of a single value returns: the value, or why there is none.
Definition MaxMatrixError.h:141
What a function that can fail returns when it has no value to return.
Definition MaxMatrixError.h:73
A view of size() elements that another owns: a font, a bitmap, a text or a buffer.
Definition span.h:64
MAXMATRIX_NODISCARD constexpr size_type size() const
Returns the number of elements.
Definition span.h:126
Elements that lie elsewhere, reached by index within their size, as std::span.
A char of a text, as Font::DecodeChar() reads it.
Definition Font.h:70
char c
Definition Font.h:71
uint8_t length
Definition Font.h:72
A char of a font, as it lies in flash: where its columns are, and how many.
Definition Font.h:48
span< uint8_t const > columns
Definition Font.h:50
uint8_t height
Definition Font.h:51
A sprite of your own: its width, its height and up to five columns.
Definition Font.h:38
uint8_t width
Definition Font.h:39
uint8_t height
Definition Font.h:40
array< uint8_t, kSpriteMaxWidth > columns
Definition Font.h:43
A C array of N elements that knows its size.
Definition array.h:42