#pragma once #ifndef HW_LIB_FONT_H #define HW_LIB_FONT_H #ifdef __cplusplus extern "C" { #endif #include "stdlib.h" #include "string.h" #include #include #include #include "lvgl_font.h" // 定义像素颜色的位数 #define PIX_COLOR_SIZE 1 // 启用单行刷新 //#define LINE_FAST_SHOW typedef struct Font Font_f_t; typedef void (*Font_Show_t)(Font_f_t *font, uint8_t *data, size_t len); struct Font { void *dev; uint8_t dev_w; uint16_t x, y, w, h; Font_Show_t show; #if PIX_COLOR_SIZE == 16 uint16_t pixcolor; uint16_t backgroundcolor; #endif }; uint8_t Font_utf8_to_unicode(uint8_t *pInput, uint32_t *unicode_letter); uint8_t Font_draw_letter(const lv_font_t *font, Font_f_t *fd, uint32_t letter, int16_t pos_x, int16_t pos_y); #ifdef __cplusplus } #endif #endif