EdSaGfmvA/include/oled/lv_font.h
2025-08-18 00:48:30 +02:00

89 lines
2.6 KiB
C

// File: lv_font.h (muss unter include/oled/lv_font.h liegen)
#ifndef LV_FONT_H
#define LV_FONT_H
#include <stdint.h>
#include <stdbool.h>
#include <stddef.h>
// Makro-Definitionen, die in der generierten font.c verwendet werden
#define LV_VERSION_CHECK(major, minor, patch) 0
#ifndef LV_ATTRIBUTE_LARGE_CONST
#define LV_ATTRIBUTE_LARGE_CONST
#endif
// Enum für den Font-Subpixel-Typ
enum { LV_FONT_SUBPX_NONE };
// Enum für den CMap-Typ
typedef uint8_t lv_font_fmt_txt_cmap_type_t;
enum { LV_FONT_FMT_TXT_CMAP_FORMAT0_TINY };
/* Vordeklaration der Haupt-Struktur */
struct _lv_font_t;
/* Struktur zur Beschreibung eines einzelnen Zeichens (Glyph) */
typedef struct {
uint32_t bitmap_index;
uint32_t adv_w;
uint16_t box_w;
uint16_t box_h;
int16_t ofs_x;
int16_t ofs_y;
} lv_font_glyph_dsc_t;
/* Struktur für das Character-Mapping */
typedef struct {
uint32_t range_start;
uint16_t range_length;
uint16_t glyph_id_start;
const void * unicode_list;
const void * glyph_id_ofs_list;
uint16_t list_length;
lv_font_fmt_txt_cmap_type_t type;
} lv_font_fmt_txt_cmap_t;
/* Struktur für Kerning-Paare */
typedef struct {
const void * glyph_ids;
const int8_t * values;
uint16_t pair_cnt;
uint8_t glyph_ids_size;
} lv_font_fmt_txt_kern_pair_t;
/* Haupt-Datenstruktur der Schriftart */
typedef struct {
const uint8_t * glyph_bitmap;
const lv_font_glyph_dsc_t * glyph_dsc;
const lv_font_fmt_txt_cmap_t * cmaps;
const void * kern_dsc;
uint16_t kern_scale;
uint16_t cmap_num;
uint16_t bpp;
uint16_t kern_classes;
uint8_t bitmap_format;
void* cache;
} lv_font_fmt_txt_dsc_t;
/* Die Haupt-Schriftart-Struktur, die Ihr Code verwendet */
typedef struct _lv_font_t {
bool (*get_glyph_dsc)(const struct _lv_font_t *, lv_font_glyph_dsc_t *, uint32_t, uint32_t);
const uint8_t * (*get_glyph_bitmap)(const struct _lv_font_t *, uint32_t);
int16_t line_height;
int16_t base_line;
uint8_t subpx;
int8_t underline_position;
int8_t underline_thickness;
const void * dsc;
const struct _lv_font_t * fallback;
void * user_data;
} lv_font_t;
/* Funktionsprototypen, die in font.c existieren */
bool lv_font_get_glyph_dsc_fmt_txt(const lv_font_t * font, lv_font_glyph_dsc_t * dsc_out, uint32_t unicode_letter, uint32_t unicode_letter_next);
const uint8_t * lv_font_get_bitmap_fmt_txt(const lv_font_t * font, uint32_t unicode_letter);
/* Makro, um die Schriftart aus Ihrer font.c bekannt zu machen */
#define LV_FONT_DECLARE(font_name) extern const lv_font_t font_name;
#endif /*LV_FONT_H*/