2024-02-02 08:53:17 +00:00
|
|
|
// custom font data
|
|
|
|
//
|
|
|
|
// Date: 2024-02-02
|
|
|
|
#pragma once
|
|
|
|
#include <base/utils.h>
|
|
|
|
|
2024-02-06 03:49:41 +00:00
|
|
|
|
|
|
|
namespace custom_font
|
|
|
|
{
|
|
|
|
enum font_size
|
|
|
|
{
|
|
|
|
FONT_SIZE_8 = 0,
|
|
|
|
FONT_SIZE_16,
|
|
|
|
FONT_SIZE_24,
|
|
|
|
FONT_SIZE_32,
|
|
|
|
};
|
|
|
|
|
|
|
|
// Function: get character font dot-array data
|
|
|
|
//
|
|
|
|
// Parameters: str - character
|
|
|
|
//
|
|
|
|
// fs - font height
|
|
|
|
//
|
|
|
|
// Return: the dot array buffer (do not free the buffer)
|
|
|
|
//
|
|
|
|
// NOTE: the ptr[0] is cols and ptr[1] is rows, real dot-array data started from ptr[2]
|
|
|
|
uint8_t* get_font_data(const char* str, font_size fs = FONT_SIZE_16);
|
|
|
|
|
|
|
|
// Function: get string font dot-array data
|
|
|
|
//
|
|
|
|
// Parameters: text - string
|
|
|
|
//
|
|
|
|
// ptr - to receive the font data (do not free the buffer), user should ensure enough space
|
|
|
|
//
|
|
|
|
// NOTE: the ptr[i][0] is cols and ptr[i][1] is rows, real dot-array data started from ptr[i][2]
|
|
|
|
//
|
|
|
|
// fs - font height
|
|
|
|
//
|
|
|
|
// Return: words of the text or valid data put in ptr
|
|
|
|
int get_string_font(const char* text, uint8_t** ptr, custom_font::font_size fs = FONT_SIZE_16);
|
|
|
|
};
|