HW_Lib/lib/font/inc/font_t.h

50 lines
977 B
C
Raw Normal View History

2024-06-25 10:17:14 +00:00
#pragma once
2024-09-17 08:32:06 +00:00
#ifndef HW_LIB_FONT_T_H
#define HW_LIB_FONT_T_H
2024-06-25 10:17:14 +00:00
#ifdef __cplusplus
extern "C" {
#endif
#include "stdlib.h"
#include "string.h"
#include <stdio.h>
#include <stdint.h>
#include <stdbool.h>
2024-08-29 08:46:54 +00:00
#include "lvgl_font.h"
2024-06-25 10:17:14 +00:00
// 定义像素颜色的位数
2024-09-16 14:51:12 +00:00
#define PIX_COLOR_SIZE 16
2024-06-25 10:17:14 +00:00
// 启用单行刷新
2024-06-25 14:09:23 +00:00
//#define LINE_FAST_SHOW
2024-06-25 10:17:14 +00:00
typedef struct Font Font_f_t;
2024-09-16 14:51:12 +00:00
#if PIX_COLOR_SIZE == 1
2024-06-25 10:17:14 +00:00
typedef void (*Font_Show_t)(Font_f_t *font, uint8_t *data, size_t len);
2024-09-16 14:51:12 +00:00
#endif
#if PIX_COLOR_SIZE == 16
typedef void (*Font_Show_t)(Font_f_t *font, uint16_t *data, size_t len);
#endif
2024-06-25 10:17:14 +00:00
struct Font {
void *dev;
2024-09-16 14:51:12 +00:00
uint16_t dev_w;
2024-06-25 10:17:14 +00:00
uint16_t x, y, w, h;
Font_Show_t show;
#if PIX_COLOR_SIZE == 16
uint16_t pixcolor;
uint16_t backgroundcolor;
#endif
};
2024-07-05 15:09:54 +00:00
uint8_t Font_utf8_to_unicode(uint8_t *pInput, uint32_t *unicode_letter);
2024-06-25 10:17:14 +00:00
2024-07-05 15:09:54 +00:00
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);
2024-06-25 10:17:14 +00:00
#ifdef __cplusplus
}
#endif
2024-08-29 08:46:54 +00:00
#endif