v.0.1.1 rm fontHeight_NxM

This commit is contained in:
tiijay
2025-11-07 14:42:45 +01:00
parent b3d9b6bb6c
commit 5b633b3ac4
9 changed files with 23 additions and 32 deletions

View File

@@ -10,8 +10,3 @@ const std::vector<uint16_t> &getFontChar_16x16(char c)
}
return font_16x16.at(' '); // Fallback to space
}
const uint8_t fontHeight_16x16()
{
return 16;
}

View File

@@ -115,6 +115,5 @@ const std::map<uint8_t, std::vector<uint16_t>> font_16x16 = {
// Declarations only
const std::vector<uint16_t> &getFontChar_16x16(char c);
const uint8_t fontHeight_16x16();
#endif

View File

@@ -10,8 +10,3 @@ const std::vector<uint8_t> &getFontChar_5x7(char c)
}
return font_5x7.at(' '); // Fallback to space
}
const uint8_t fontHeight_5x7()
{
return 7;
}

View File

@@ -117,6 +117,5 @@ const std::map<uint8_t, std::vector<uint8_t>> font_5x7 = {
// Declarations only
const vector<uint8_t> &getFontChar_5x7(char c);
const uint8_t fontHeight_5x7();
#endif

View File

@@ -10,8 +10,3 @@ const std::vector<uint8_t> &getFontChar_8x8(char c)
}
return font_8x8.at(' '); // Fallback to space
}
const uint8_t fontHeight_8x8()
{
return 8;
}

View File

@@ -112,6 +112,5 @@ const std::map<uint8_t, std::vector<uint8_t>> font_8x8 = {
// Declarations only
const std::vector<uint8_t> &getFontChar_8x8(char c);
const uint8_t fontHeight_8x8();
#endif

View File

@@ -59,17 +59,19 @@ void LedMatrix::drawPixel(int x, int y, CRGB color)
uint8_t LedMatrix::drawChar(int x, int y, char c, CRGB color)
{
#ifdef USE_FONT_5x7
const u_int8_t font_width = 5;
const std::map<uint8_t, std::vector<uint8_t>> &font = font_5x7;
#elifdef USE_FONT_8x8
const u_int8_t font_width = 8;
const std::map<uint8_t, std::vector<uint8_t>> &font = font_8x8;
#elifdef USE_FONT_16x16
const std::map<uint8_t, std::vector<uint8_t>> &font = font_16x16;
const u_int8_t font_width = 16;
const std::map<uint8_t, std::vector<uint16_t>> &font = font_16x16;
#endif
const vector<uint8_t> &fontData_ = getFontChar(c, font);
const uint8_t *fontData = fontData_.data();
const u_int8_t char_width_pixel = charWidth(fontData);
const u_int8_t font_height = getFontHeight();
const u_int8_t font_width = 5;
for (u_int8_t row = 0; row < font_height; row++)
{
@@ -118,7 +120,7 @@ const uint8_t LedMatrix::getTextWidth(const char *text)
#elifdef USE_FONT_8x8
const std::map<uint8_t, std::vector<uint8_t>> &font = font_8x8;
#elifdef USE_FONT_16x16
const std::map<uint8_t, std::vector<uint8_t>> &font = font_16x16;
const std::map<uint8_t, std::vector<uint16_t>> &font = font_16x16;
#endif
const vector<uint8_t> &fontData_ = getFontChar(text[i], font);

View File

@@ -3,8 +3,8 @@
using namespace std;
#define USE_FONT_5x7
// #define USE_FONT_8x8
// #define USE_FONT_5x7
#define USE_FONT_8x8
// #define USE_FONT_16x16
#include <Arduino.h>