LVGL 库提交

This commit is contained in:
2026-08-30 08:57:07 +08:00
parent 0b59118ddd
commit bc07701ed5
1056 changed files with 556743 additions and 45 deletions
+724
View File
@@ -0,0 +1,724 @@
/**
* @file lv_binfont_loader.c
*
*/
/*********************
* INCLUDES
*********************/
#include "lv_font_fmt_txt_private.h"
#include "../lvgl.h"
#include "../misc/lv_fs_private.h"
#include "../misc/lv_types.h"
#include "../stdlib/lv_string.h"
#include "lv_binfont_loader.h"
/**********************
* TYPEDEFS
**********************/
typedef struct {
lv_fs_file_t * fp;
int8_t bit_pos;
uint8_t byte_value;
} bit_iterator_t;
typedef struct font_header_bin {
uint32_t version;
uint16_t tables_count;
uint16_t font_size;
uint16_t ascent;
int16_t descent;
uint16_t typo_ascent;
int16_t typo_descent;
uint16_t typo_line_gap;
int16_t min_y;
int16_t max_y;
uint16_t default_advance_width;
uint16_t kerning_scale;
uint8_t index_to_loc_format;
uint8_t glyph_id_format;
uint8_t advance_width_format;
uint8_t bits_per_pixel;
uint8_t xy_bits;
uint8_t wh_bits;
uint8_t advance_width_bits;
uint8_t compression_id;
uint8_t subpixels_mode;
uint8_t padding;
int16_t underline_position;
uint16_t underline_thickness;
} font_header_bin_t;
typedef struct cmap_table_bin {
uint32_t data_offset;
uint32_t range_start;
uint16_t range_length;
uint16_t glyph_id_start;
uint16_t data_entries_count;
uint8_t format_type;
uint8_t padding;
} cmap_table_bin_t;
/**********************
* STATIC PROTOTYPES
**********************/
static bit_iterator_t init_bit_iterator(lv_fs_file_t * fp);
static bool lvgl_load_font(lv_fs_file_t * fp, lv_font_t * font);
int32_t load_kern(lv_fs_file_t * fp, lv_font_fmt_txt_dsc_t * font_dsc, uint8_t format, uint32_t start);
static int read_bits_signed(bit_iterator_t * it, int n_bits, lv_fs_res_t * res);
static unsigned int read_bits(bit_iterator_t * it, int n_bits, lv_fs_res_t * res);
static lv_font_t * binfont_font_create_cb(const lv_font_info_t * info, const void * src);
static void binfont_font_delete_cb(lv_font_t * font);
static void * binfont_font_dup_src_cb(const void * src);
static void binfont_font_free_src_cb(void * src);
/**********************
* MACROS
**********************/
/**********************
* GLOBAL VARIABLES
**********************/
const lv_font_class_t lv_binfont_font_class = {
.create_cb = binfont_font_create_cb,
.delete_cb = binfont_font_delete_cb,
.dup_src_cb = binfont_font_dup_src_cb,
.free_src_cb = binfont_font_free_src_cb,
};
/**********************
* GLOBAL FUNCTIONS
**********************/
lv_font_t * lv_binfont_create(const char * path)
{
LV_ASSERT_NULL(path);
lv_fs_file_t file;
lv_fs_res_t fs_res = lv_fs_open(&file, path, LV_FS_MODE_RD);
if(fs_res != LV_FS_RES_OK) return NULL;
lv_font_t * font = lv_malloc_zeroed(sizeof(lv_font_t));
LV_ASSERT_MALLOC(font);
if(!lvgl_load_font(&file, font)) {
LV_LOG_WARN("Error loading font file: %s", path);
/*
* When `lvgl_load_font` fails it can leak some pointers.
* All non-null pointers can be assumed as allocated and
* `lv_binfont_destroy` should free them correctly.
*/
lv_binfont_destroy(font);
font = NULL;
}
lv_fs_close(&file);
return font;
}
#if LV_USE_FS_MEMFS
lv_font_t * lv_binfont_create_from_buffer(void * buffer, uint32_t size)
{
lv_fs_path_ex_t mempath;
lv_fs_make_path_from_buffer(&mempath, LV_FS_MEMFS_LETTER, buffer, size);
return lv_binfont_create((const char *)&mempath);
}
#endif
void lv_binfont_destroy(lv_font_t * font)
{
if(font == NULL) return;
const lv_font_fmt_txt_dsc_t * dsc = font->dsc;
if(dsc == NULL) return;
if(dsc->kern_classes == 0) {
const lv_font_fmt_txt_kern_pair_t * kern_dsc = dsc->kern_dsc;
if(NULL != kern_dsc) {
lv_free((void *)kern_dsc->glyph_ids);
lv_free((void *)kern_dsc->values);
lv_free((void *)kern_dsc);
}
}
else {
const lv_font_fmt_txt_kern_classes_t * kern_dsc = dsc->kern_dsc;
if(NULL != kern_dsc) {
lv_free((void *)kern_dsc->class_pair_values);
lv_free((void *)kern_dsc->left_class_mapping);
lv_free((void *)kern_dsc->right_class_mapping);
lv_free((void *)kern_dsc);
}
}
const lv_font_fmt_txt_cmap_t * cmaps = dsc->cmaps;
if(NULL != cmaps) {
for(int i = 0; i < dsc->cmap_num; ++i) {
lv_free((void *)cmaps[i].glyph_id_ofs_list);
lv_free((void *)cmaps[i].unicode_list);
}
lv_free((void *)cmaps);
}
lv_free((void *)dsc->glyph_bitmap);
lv_free((void *)dsc->glyph_dsc);
lv_free((void *)dsc);
lv_free(font);
}
/**********************
* STATIC FUNCTIONS
**********************/
static bit_iterator_t init_bit_iterator(lv_fs_file_t * fp)
{
bit_iterator_t it;
it.fp = fp;
it.bit_pos = -1;
it.byte_value = 0;
return it;
}
static unsigned int read_bits(bit_iterator_t * it, int n_bits, lv_fs_res_t * res)
{
unsigned int value = 0;
while(n_bits--) {
it->byte_value = it->byte_value << 1;
it->bit_pos--;
if(it->bit_pos < 0) {
it->bit_pos = 7;
*res = lv_fs_read(it->fp, &(it->byte_value), 1, NULL);
if(*res != LV_FS_RES_OK) {
return 0;
}
}
int8_t bit = (it->byte_value & 0x80) ? 1 : 0;
value |= (bit << n_bits);
}
*res = LV_FS_RES_OK;
return value;
}
static int read_bits_signed(bit_iterator_t * it, int n_bits, lv_fs_res_t * res)
{
unsigned int value = read_bits(it, n_bits, res);
if(value & (1 << (n_bits - 1))) {
value |= ~0u << n_bits;
}
return value;
}
static int read_label(lv_fs_file_t * fp, int start, const char * label)
{
lv_fs_seek(fp, start, LV_FS_SEEK_SET);
uint32_t length;
char buf[4];
if(lv_fs_read(fp, &length, 4, NULL) != LV_FS_RES_OK
|| lv_fs_read(fp, buf, 4, NULL) != LV_FS_RES_OK
|| lv_memcmp(label, buf, 4) != 0) {
LV_LOG_WARN("Error reading '%s' label.", label);
return -1;
}
return length;
}
static bool load_cmaps_tables(lv_fs_file_t * fp, lv_font_fmt_txt_dsc_t * font_dsc,
uint32_t cmaps_start, cmap_table_bin_t * cmap_table)
{
if(lv_fs_read(fp, cmap_table, font_dsc->cmap_num * sizeof(cmap_table_bin_t), NULL) != LV_FS_RES_OK) {
return false;
}
for(unsigned int i = 0; i < font_dsc->cmap_num; ++i) {
lv_fs_res_t res = lv_fs_seek(fp, cmaps_start + cmap_table[i].data_offset, LV_FS_SEEK_SET);
if(res != LV_FS_RES_OK) {
return false;
}
lv_font_fmt_txt_cmap_t * cmap = (lv_font_fmt_txt_cmap_t *) & (font_dsc->cmaps[i]);
cmap->range_start = cmap_table[i].range_start;
cmap->range_length = cmap_table[i].range_length;
cmap->glyph_id_start = cmap_table[i].glyph_id_start;
cmap->type = cmap_table[i].format_type;
switch(cmap_table[i].format_type) {
case LV_FONT_FMT_TXT_CMAP_FORMAT0_FULL: {
uint8_t ids_size = (uint8_t)(sizeof(uint8_t) * cmap_table[i].data_entries_count);
uint8_t * glyph_id_ofs_list = lv_malloc(ids_size);
cmap->glyph_id_ofs_list = glyph_id_ofs_list;
if(lv_fs_read(fp, glyph_id_ofs_list, ids_size, NULL) != LV_FS_RES_OK) {
return false;
}
cmap->list_length = cmap->range_length;
break;
}
case LV_FONT_FMT_TXT_CMAP_FORMAT0_TINY:
break;
case LV_FONT_FMT_TXT_CMAP_SPARSE_FULL:
case LV_FONT_FMT_TXT_CMAP_SPARSE_TINY: {
uint32_t list_size = sizeof(uint16_t) * cmap_table[i].data_entries_count;
uint16_t * unicode_list = (uint16_t *)lv_malloc(list_size);
cmap->unicode_list = unicode_list;
cmap->list_length = cmap_table[i].data_entries_count;
if(lv_fs_read(fp, unicode_list, list_size, NULL) != LV_FS_RES_OK) {
return false;
}
if(cmap_table[i].format_type == LV_FONT_FMT_TXT_CMAP_SPARSE_FULL) {
uint16_t * buf = lv_malloc(sizeof(uint16_t) * cmap->list_length);
cmap->glyph_id_ofs_list = buf;
if(lv_fs_read(fp, buf, sizeof(uint16_t) * cmap->list_length, NULL) != LV_FS_RES_OK) {
return false;
}
}
break;
}
default:
LV_LOG_WARN("Unknown cmaps format type %d.", cmap_table[i].format_type);
return false;
}
}
return true;
}
static int32_t load_cmaps(lv_fs_file_t * fp, lv_font_fmt_txt_dsc_t * font_dsc, uint32_t cmaps_start)
{
int32_t cmaps_length = read_label(fp, cmaps_start, "cmap");
if(cmaps_length < 0) {
return -1;
}
uint32_t cmaps_subtables_count;
if(lv_fs_read(fp, &cmaps_subtables_count, sizeof(uint32_t), NULL) != LV_FS_RES_OK) {
return -1;
}
lv_font_fmt_txt_cmap_t * cmaps =
lv_malloc(cmaps_subtables_count * sizeof(lv_font_fmt_txt_cmap_t));
lv_memset(cmaps, 0, cmaps_subtables_count * sizeof(lv_font_fmt_txt_cmap_t));
font_dsc->cmaps = cmaps;
font_dsc->cmap_num = cmaps_subtables_count;
cmap_table_bin_t * cmaps_tables = lv_malloc(sizeof(cmap_table_bin_t) * font_dsc->cmap_num);
bool success = load_cmaps_tables(fp, font_dsc, cmaps_start, cmaps_tables);
lv_free(cmaps_tables);
return success ? cmaps_length : -1;
}
static int32_t load_glyph(lv_fs_file_t * fp, lv_font_fmt_txt_dsc_t * font_dsc,
uint32_t start, uint32_t * glyph_offset, uint32_t loca_count, font_header_bin_t * header)
{
int32_t glyph_length = read_label(fp, start, "glyf");
if(glyph_length < 0) {
return -1;
}
lv_font_fmt_txt_glyph_dsc_t * glyph_dsc = (lv_font_fmt_txt_glyph_dsc_t *)
lv_malloc(loca_count * sizeof(lv_font_fmt_txt_glyph_dsc_t));
lv_memset(glyph_dsc, 0, loca_count * sizeof(lv_font_fmt_txt_glyph_dsc_t));
font_dsc->glyph_dsc = glyph_dsc;
int cur_bmp_size = 0;
for(unsigned int i = 0; i < loca_count; ++i) {
lv_font_fmt_txt_glyph_dsc_t * gdsc = &glyph_dsc[i];
lv_fs_res_t res = lv_fs_seek(fp, start + glyph_offset[i], LV_FS_SEEK_SET);
if(res != LV_FS_RES_OK) {
return -1;
}
bit_iterator_t bit_it = init_bit_iterator(fp);
if(header->advance_width_bits == 0) {
gdsc->adv_w = header->default_advance_width;
}
else {
gdsc->adv_w = read_bits(&bit_it, header->advance_width_bits, &res);
if(res != LV_FS_RES_OK) {
return -1;
}
}
if(header->advance_width_format == 0) {
gdsc->adv_w *= 16;
}
gdsc->ofs_x = read_bits_signed(&bit_it, header->xy_bits, &res);
if(res != LV_FS_RES_OK) {
return -1;
}
gdsc->ofs_y = read_bits_signed(&bit_it, header->xy_bits, &res);
if(res != LV_FS_RES_OK) {
return -1;
}
gdsc->box_w = read_bits(&bit_it, header->wh_bits, &res);
if(res != LV_FS_RES_OK) {
return -1;
}
gdsc->box_h = read_bits(&bit_it, header->wh_bits, &res);
if(res != LV_FS_RES_OK) {
return -1;
}
int nbits = header->advance_width_bits + 2 * header->xy_bits + 2 * header->wh_bits;
int next_offset = (i < loca_count - 1) ? glyph_offset[i + 1] : (uint32_t)glyph_length;
int bmp_size = next_offset - glyph_offset[i] - nbits / 8;
if(i == 0) {
gdsc->adv_w = 0;
gdsc->box_w = 0;
gdsc->box_h = 0;
gdsc->ofs_x = 0;
gdsc->ofs_y = 0;
}
gdsc->bitmap_index = cur_bmp_size;
if(gdsc->box_w * gdsc->box_h != 0) {
cur_bmp_size += bmp_size;
}
}
uint8_t * glyph_bmp = (uint8_t *)lv_malloc(sizeof(uint8_t) * cur_bmp_size);
font_dsc->glyph_bitmap = glyph_bmp;
cur_bmp_size = 0;
for(unsigned int i = 1; i < loca_count; ++i) {
lv_fs_res_t res = lv_fs_seek(fp, start + glyph_offset[i], LV_FS_SEEK_SET);
if(res != LV_FS_RES_OK) {
return -1;
}
bit_iterator_t bit_it = init_bit_iterator(fp);
int nbits = header->advance_width_bits + 2 * header->xy_bits + 2 * header->wh_bits;
read_bits(&bit_it, nbits, &res);
if(res != LV_FS_RES_OK) {
return -1;
}
if(glyph_dsc[i].box_w * glyph_dsc[i].box_h == 0) {
continue;
}
int next_offset = (i < loca_count - 1) ? glyph_offset[i + 1] : (uint32_t)glyph_length;
int bmp_size = next_offset - glyph_offset[i] - nbits / 8;
if(nbits % 8 == 0) { /*Fast path*/
if(lv_fs_read(fp, &glyph_bmp[cur_bmp_size], bmp_size, NULL) != LV_FS_RES_OK) {
return -1;
}
}
else {
for(int k = 0; k < bmp_size - 1; ++k) {
glyph_bmp[cur_bmp_size + k] = read_bits(&bit_it, 8, &res);
if(res != LV_FS_RES_OK) {
return -1;
}
}
glyph_bmp[cur_bmp_size + bmp_size - 1] = read_bits(&bit_it, 8 - nbits % 8, &res);
if(res != LV_FS_RES_OK) {
return -1;
}
/*The last fragment should be on the MSB but read_bits() will place it to the LSB*/
glyph_bmp[cur_bmp_size + bmp_size - 1] = glyph_bmp[cur_bmp_size + bmp_size - 1] << (nbits % 8);
}
cur_bmp_size += bmp_size;
}
return glyph_length;
}
/*
* Loads a `lv_font_t` from a binary file, given a `lv_fs_file_t`.
*
* Memory allocations on `lvgl_load_font` should be immediately zeroed and
* the pointer should be set on the `lv_font_t` data before any possible return.
*
* When something fails, it returns `false` and the memory on the `lv_font_t`
* still needs to be freed using `lv_binfont_destroy`.
*
* `lv_binfont_destroy` will assume that all non-null pointers are allocated and
* should be freed.
*/
static bool lvgl_load_font(lv_fs_file_t * fp, lv_font_t * font)
{
lv_font_fmt_txt_dsc_t * font_dsc = (lv_font_fmt_txt_dsc_t *)
lv_malloc(sizeof(lv_font_fmt_txt_dsc_t));
lv_memset(font_dsc, 0, sizeof(lv_font_fmt_txt_dsc_t));
font->dsc = font_dsc;
/*header*/
int32_t header_length = read_label(fp, 0, "head");
if(header_length < 0) {
return false;
}
font_header_bin_t font_header;
if(lv_fs_read(fp, &font_header, sizeof(font_header_bin_t), NULL) != LV_FS_RES_OK) {
return false;
}
font->base_line = -font_header.descent;
font->line_height = font_header.ascent - font_header.descent;
font->get_glyph_dsc = lv_font_get_glyph_dsc_fmt_txt;
font->get_glyph_bitmap = lv_font_get_bitmap_fmt_txt;
font->subpx = font_header.subpixels_mode;
font->underline_position = (int8_t) font_header.underline_position;
font->underline_thickness = (int8_t) font_header.underline_thickness;
font_dsc->bpp = font_header.bits_per_pixel;
font_dsc->kern_scale = font_header.kerning_scale;
font_dsc->bitmap_format = font_header.compression_id;
/*cmaps*/
uint32_t cmaps_start = header_length;
int32_t cmaps_length = load_cmaps(fp, font_dsc, cmaps_start);
if(cmaps_length < 0) {
return false;
}
/*loca*/
uint32_t loca_start = cmaps_start + cmaps_length;
int32_t loca_length = read_label(fp, loca_start, "loca");
if(loca_length < 0) {
return false;
}
uint32_t loca_count;
if(lv_fs_read(fp, &loca_count, sizeof(uint32_t), NULL) != LV_FS_RES_OK) {
return false;
}
bool failed = false;
uint32_t * glyph_offset = lv_malloc(sizeof(uint32_t) * (loca_count + 1));
if(font_header.index_to_loc_format == 0) {
for(unsigned int i = 0; i < loca_count; ++i) {
uint16_t offset;
if(lv_fs_read(fp, &offset, sizeof(uint16_t), NULL) != LV_FS_RES_OK) {
failed = true;
break;
}
glyph_offset[i] = offset;
}
}
else if(font_header.index_to_loc_format == 1) {
if(lv_fs_read(fp, glyph_offset, loca_count * sizeof(uint32_t), NULL) != LV_FS_RES_OK) {
failed = true;
}
}
else {
LV_LOG_WARN("Unknown index_to_loc_format: %d.", font_header.index_to_loc_format);
failed = true;
}
if(failed) {
lv_free(glyph_offset);
return false;
}
/*glyph*/
uint32_t glyph_start = loca_start + loca_length;
int32_t glyph_length = load_glyph(
fp, font_dsc, glyph_start, glyph_offset, loca_count, &font_header);
lv_free(glyph_offset);
if(glyph_length < 0) {
return false;
}
/*kerning*/
if(font_header.tables_count < 4) {
font_dsc->kern_dsc = NULL;
font_dsc->kern_classes = 0;
font_dsc->kern_scale = 0;
return true;
}
uint32_t kern_start = glyph_start + glyph_length;
int32_t kern_length = load_kern(fp, font_dsc, font_header.glyph_id_format, kern_start);
return kern_length >= 0;
}
int32_t load_kern(lv_fs_file_t * fp, lv_font_fmt_txt_dsc_t * font_dsc, uint8_t format, uint32_t start)
{
int32_t kern_length = read_label(fp, start, "kern");
if(kern_length < 0) {
return -1;
}
uint8_t kern_format_type;
int32_t padding;
if(lv_fs_read(fp, &kern_format_type, sizeof(uint8_t), NULL) != LV_FS_RES_OK ||
lv_fs_read(fp, &padding, 3 * sizeof(uint8_t), NULL) != LV_FS_RES_OK) {
return -1;
}
if(0 == kern_format_type) { /*sorted pairs*/
lv_font_fmt_txt_kern_pair_t * kern_pair = lv_malloc(sizeof(lv_font_fmt_txt_kern_pair_t));
lv_memset(kern_pair, 0, sizeof(lv_font_fmt_txt_kern_pair_t));
font_dsc->kern_dsc = kern_pair;
font_dsc->kern_classes = 0;
uint32_t glyph_entries;
if(lv_fs_read(fp, &glyph_entries, sizeof(uint32_t), NULL) != LV_FS_RES_OK) {
return -1;
}
int ids_size;
if(format == 0) {
ids_size = sizeof(int8_t) * 2 * glyph_entries;
}
else {
ids_size = sizeof(int16_t) * 2 * glyph_entries;
}
uint8_t * glyph_ids = lv_malloc(ids_size);
int8_t * values = lv_malloc(glyph_entries);
kern_pair->glyph_ids_size = format;
kern_pair->pair_cnt = glyph_entries;
kern_pair->glyph_ids = glyph_ids;
kern_pair->values = values;
if(lv_fs_read(fp, glyph_ids, ids_size, NULL) != LV_FS_RES_OK) {
return -1;
}
if(lv_fs_read(fp, values, glyph_entries, NULL) != LV_FS_RES_OK) {
return -1;
}
}
else if(3 == kern_format_type) { /*array M*N of classes*/
lv_font_fmt_txt_kern_classes_t * kern_classes = lv_malloc(sizeof(lv_font_fmt_txt_kern_classes_t));
lv_memset(kern_classes, 0, sizeof(lv_font_fmt_txt_kern_classes_t));
font_dsc->kern_dsc = kern_classes;
font_dsc->kern_classes = 1;
uint16_t kern_class_mapping_length;
uint8_t kern_table_rows;
uint8_t kern_table_cols;
if(lv_fs_read(fp, &kern_class_mapping_length, sizeof(uint16_t), NULL) != LV_FS_RES_OK ||
lv_fs_read(fp, &kern_table_rows, sizeof(uint8_t), NULL) != LV_FS_RES_OK ||
lv_fs_read(fp, &kern_table_cols, sizeof(uint8_t), NULL) != LV_FS_RES_OK) {
return -1;
}
int kern_values_length = sizeof(int8_t) * kern_table_rows * kern_table_cols;
uint8_t * kern_left = lv_malloc(kern_class_mapping_length);
uint8_t * kern_right = lv_malloc(kern_class_mapping_length);
int8_t * kern_values = lv_malloc(kern_values_length);
kern_classes->left_class_mapping = kern_left;
kern_classes->right_class_mapping = kern_right;
kern_classes->left_class_cnt = kern_table_rows;
kern_classes->right_class_cnt = kern_table_cols;
kern_classes->class_pair_values = kern_values;
if(lv_fs_read(fp, kern_left, kern_class_mapping_length, NULL) != LV_FS_RES_OK ||
lv_fs_read(fp, kern_right, kern_class_mapping_length, NULL) != LV_FS_RES_OK ||
lv_fs_read(fp, kern_values, kern_values_length, NULL) != LV_FS_RES_OK) {
return -1;
}
}
else {
LV_LOG_WARN("Unknown kern_format_type: %d", kern_format_type);
return -1;
}
return kern_length;
}
static lv_font_t * binfont_font_create_cb(const lv_font_info_t * info, const void * src)
{
const lv_binfont_font_src_t * font_src = src;
if(info->size == font_src->font_size) {
if(font_src->path) {
return lv_binfont_create(font_src->path);
}
#if LV_USE_FS_MEMFS
return lv_binfont_create_from_buffer((void *)font_src->buffer, font_src->buffer_size);
#else
LV_LOG_WARN("LV_USE_FS_MEMFS not enabled");
return NULL;
#endif
}
return NULL;
}
static void binfont_font_delete_cb(lv_font_t * font)
{
lv_binfont_destroy(font);
}
static void * binfont_font_dup_src_cb(const void * src)
{
const lv_binfont_font_src_t * font_src = src;
lv_binfont_font_src_t * new_src = lv_malloc_zeroed(sizeof(lv_binfont_font_src_t));
LV_ASSERT_MALLOC(new_src);
*new_src = *font_src;
if(font_src->path) {
new_src->path = lv_strdup(font_src->path);
}
return new_src;
}
static void binfont_font_free_src_cb(void * src)
{
lv_binfont_font_src_t * font_src = src;
if(font_src->path) {
lv_free((char *)font_src->path);
font_src->path = NULL;
}
lv_free(font_src);
}
+71
View File
@@ -0,0 +1,71 @@
/**
* @file lv_binfont_loader.h
*
*/
#ifndef LV_BINFONT_LOADER_H
#define LV_BINFONT_LOADER_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
typedef struct {
uint32_t font_size; /**< Size of the font in pixels*/
const char * path; /**< Path to font file*/
const void * buffer; /**< Address of the font file in the memory*/
uint32_t buffer_size; /**< Size of the font file buffer*/
} lv_binfont_font_src_t;
LV_ATTRIBUTE_EXTERN_DATA extern const lv_font_class_t lv_binfont_font_class;
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Loads a `lv_font_t` object from a binary font file
* @param path path to font file
* @return pointer to font where to load
*/
lv_font_t * lv_binfont_create(const char * path);
#if LV_USE_FS_MEMFS
/**
* Loads a `lv_font_t` object from a memory buffer containing the binary font file.
* Requires LV_USE_FS_MEMFS
* @param buffer address of the font file in the memory
* @param size size of the font file buffer
* @return pointer to font where to load
*/
lv_font_t * lv_binfont_create_from_buffer(void * buffer, uint32_t size);
#endif
/**
* Frees the memory allocated by the `lv_binfont_create()` function
* @param font lv_font_t object created by the lv_binfont_create function
*/
void lv_binfont_destroy(lv_font_t * font);
/**********************
* MACROS
**********************/
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /* LV_BINFONT_LOADER_H */
+204
View File
@@ -0,0 +1,204 @@
/**
* @file lv_font.c
*
*/
/*********************
* INCLUDES
*********************/
#include "lv_font.h"
#include "../misc/lv_text_private.h"
#include "../misc/lv_utils.h"
#include "../misc/lv_log.h"
#include "../misc/lv_assert.h"
#include "../stdlib/lv_string.h"
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/**********************
* STATIC PROTOTYPES
**********************/
/**********************
* STATIC VARIABLES
**********************/
/**********************
* GLOBAL VARIABLES
**********************/
/**********************
* GLOBAL PROTOTYPES
**********************/
/**********************
* MACROS
**********************/
/**********************
* GLOBAL FUNCTIONS
**********************/
const void * lv_font_get_glyph_bitmap(lv_font_glyph_dsc_t * g_dsc, lv_draw_buf_t * draw_buf)
{
const lv_font_t * font_p = g_dsc->resolved_font;
LV_ASSERT_NULL(font_p);
const uint8_t save_req = g_dsc->req_raw_bitmap;
g_dsc->req_raw_bitmap = 0;
const void * bitmap = font_p->get_glyph_bitmap(g_dsc, draw_buf);
g_dsc->req_raw_bitmap = save_req;
return bitmap;
}
const void * lv_font_get_glyph_static_bitmap(lv_font_glyph_dsc_t * g_dsc)
{
const lv_font_t * font_p = g_dsc->resolved_font;
LV_ASSERT_NULL(font_p);
if(font_p->static_bitmap == 0) {
LV_LOG_WARN("Requesting static bitmap of a non-static bitmap of %p font", (void *)font_p);
return NULL;
}
const uint8_t save_req = g_dsc->req_raw_bitmap;
g_dsc->req_raw_bitmap = 1;
const void * bitmap = font_p->get_glyph_bitmap(g_dsc, NULL);
g_dsc->req_raw_bitmap = save_req;
return bitmap;
}
void lv_font_glyph_release_draw_data(lv_font_glyph_dsc_t * g_dsc)
{
LV_ASSERT_NULL(g_dsc);
if(!g_dsc->entry) {
return;
}
const lv_font_t * font = g_dsc->resolved_font;
if(font != NULL && font->release_glyph) {
font->release_glyph(font, g_dsc);
}
}
bool lv_font_get_glyph_dsc(const lv_font_t * font_p, lv_font_glyph_dsc_t * dsc_out, uint32_t letter,
uint32_t letter_next)
{
LV_ASSERT_NULL(font_p);
LV_ASSERT_NULL(dsc_out);
#if LV_USE_FONT_PLACEHOLDER
const lv_font_t * placeholder_font = NULL;
#endif
const lv_font_t * f = font_p;
lv_memzero(dsc_out, sizeof(lv_font_glyph_dsc_t));
while(f) {
bool found = f->get_glyph_dsc(f, dsc_out, letter, f->kerning == LV_FONT_KERNING_NONE ? 0 : letter_next);
if(found) {
if(!dsc_out->is_placeholder) {
dsc_out->resolved_font = f;
return true;
}
#if LV_USE_FONT_PLACEHOLDER
else if(placeholder_font == NULL) {
placeholder_font = f;
}
#endif
}
f = f->fallback;
}
#if LV_USE_FONT_PLACEHOLDER
if(placeholder_font != NULL) {
placeholder_font->get_glyph_dsc(placeholder_font, dsc_out, letter,
placeholder_font->kerning == LV_FONT_KERNING_NONE ? 0 : letter_next);
dsc_out->resolved_font = placeholder_font;
return true;
}
#endif
#if LV_USE_FONT_PLACEHOLDER
dsc_out->box_w = font_p->line_height / 2;
dsc_out->adv_w = dsc_out->box_w + 2;
#else
dsc_out->box_w = 0;
dsc_out->adv_w = 0;
#endif
dsc_out->stride = 0;
dsc_out->resolved_font = NULL;
dsc_out->box_h = font_p->line_height;
dsc_out->ofs_x = 0;
dsc_out->ofs_y = 0;
dsc_out->format = LV_FONT_GLYPH_FORMAT_A1;
dsc_out->is_placeholder = true;
return false;
}
uint16_t lv_font_get_glyph_width(const lv_font_t * font, uint32_t letter, uint32_t letter_next)
{
LV_ASSERT_NULL(font);
lv_font_glyph_dsc_t g;
/*Return zero if letter is marker*/
if(lv_text_is_marker(letter)) return 0;
lv_font_get_glyph_dsc(font, &g, letter, letter_next);
return g.adv_w;
}
void lv_font_set_kerning(lv_font_t * font, lv_font_kerning_t kerning)
{
LV_ASSERT_NULL(font);
font->kerning = kerning;
}
int32_t lv_font_get_line_height(const lv_font_t * font)
{
return font->line_height;
}
const lv_font_t * lv_font_get_default(void)
{
return LV_FONT_DEFAULT;
}
bool lv_font_info_is_equal(const lv_font_info_t * ft_info_1, const lv_font_info_t * ft_info_2)
{
LV_ASSERT_NULL(ft_info_1);
LV_ASSERT_NULL(ft_info_2);
bool is_equal = (ft_info_1->size == ft_info_2->size
&& ft_info_1->style == ft_info_2->style
&& ft_info_1->render_mode == ft_info_2->render_mode
&& ft_info_1->kerning == ft_info_2->kerning
&& lv_strcmp(ft_info_1->name, ft_info_2->name) == 0);
return is_equal;
}
bool lv_font_has_static_bitmap(const lv_font_t * font)
{
return font->static_bitmap;
}
/**********************
* STATIC FUNCTIONS
**********************/
+358
View File
@@ -0,0 +1,358 @@
/**
* @file lv_font.h
*
*/
#ifndef LV_FONT_H
#define LV_FONT_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../lv_conf_internal.h"
#include "../misc/lv_types.h"
#include "lv_symbol_def.h"
#include "../draw/lv_draw_buf.h"
#include "../misc/lv_area.h"
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/*------------------
* General types
*-----------------*/
/** The font format.*/
typedef enum {
LV_FONT_GLYPH_FORMAT_NONE = 0, /**< Maybe not visible*/
/**< Legacy simple formats with no byte padding at end of the lines*/
LV_FONT_GLYPH_FORMAT_A1 = 0x01, /**< 1 bit per pixel*/
LV_FONT_GLYPH_FORMAT_A2 = 0x02, /**< 2 bit per pixel*/
LV_FONT_GLYPH_FORMAT_A3 = 0x03, /**< 3 bit per pixel*/
LV_FONT_GLYPH_FORMAT_A4 = 0x04, /**< 4 bit per pixel*/
LV_FONT_GLYPH_FORMAT_A8 = 0x08, /**< 8 bit per pixel*/
LV_FONT_GLYPH_FORMAT_IMAGE = 0x19, /**< Image format*/
/**< Advanced formats*/
LV_FONT_GLYPH_FORMAT_VECTOR = 0x1A, /**< Vectorial format*/
LV_FONT_GLYPH_FORMAT_SVG = 0x1B, /**< SVG format*/
LV_FONT_GLYPH_FORMAT_CUSTOM = 0xFF, /**< Custom format*/
} lv_font_glyph_format_t;
/** Describes the properties of a glyph.*/
typedef struct {
const lv_font_t *
resolved_font; /**< Pointer to a font where the glyph was actually found after handling fallbacks*/
uint16_t adv_w; /**< The glyph needs this space. Draw the next glyph after this width.*/
uint16_t box_w; /**< Width of the glyph's bounding box*/
uint16_t box_h; /**< Height of the glyph's bounding box*/
int16_t ofs_x; /**< x offset of the bounding box*/
int16_t ofs_y; /**< y offset of the bounding box*/
uint16_t stride;/**< Bytes in each line. If 0 than there is no padding at the end of the line. */
lv_font_glyph_format_t format; /**< Font format of the glyph see lv_font_glyph_format_t */
uint8_t is_placeholder: 1; /**< Glyph is missing. But placeholder will still be displayed*/
/** 0: Get bitmap should return an A8 or ARGB8888 image.
* 1: return the bitmap as it is (Maybe A1/2/4 or any proprietary formats). */
uint8_t req_raw_bitmap: 1;
int32_t outline_stroke_width; /**< used with freetype vector fonts - width of the letter outline */
union {
uint32_t index; /**< Unicode code point*/
const void * src; /**< Pointer to the source data used by image fonts*/
} gid; /**< The index of the glyph in the font file. Used by the font cache*/
lv_cache_entry_t * entry; /**< The cache entry of the glyph draw data. Used by the font cache*/
} lv_font_glyph_dsc_t;
/** The bitmaps might be upscaled by 3 to achieve subpixel rendering.*/
typedef enum {
LV_FONT_SUBPX_NONE,
LV_FONT_SUBPX_HOR,
LV_FONT_SUBPX_VER,
LV_FONT_SUBPX_BOTH,
} lv_font_subpx_t;
/** Adjust letter spacing for specific character pairs.*/
typedef enum {
LV_FONT_KERNING_NORMAL,
LV_FONT_KERNING_NONE,
} lv_font_kerning_t;
/** Describe the properties of a font*/
struct _lv_font_t {
/** Get a glyph's descriptor from a font*/
bool (*get_glyph_dsc)(const lv_font_t *, lv_font_glyph_dsc_t *, uint32_t letter, uint32_t letter_next);
/** Get a glyph's bitmap from a font*/
const void * (*get_glyph_bitmap)(lv_font_glyph_dsc_t *, lv_draw_buf_t *);
/** Release a glyph*/
void (*release_glyph)(const lv_font_t *, lv_font_glyph_dsc_t *);
/*Pointer to the font in a font pack (must have the same line height)*/
int32_t line_height; /**< The real line height where any text fits*/
int32_t base_line; /**< Base line measured from the bottom of the line_height*/
uint8_t subpx : 2; /**< An element of `lv_font_subpx_t`*/
uint8_t kerning : 1; /**< An element of `lv_font_kerning_t`*/
uint8_t static_bitmap : 1; /**< The font will be used as static bitmap */
int8_t underline_position; /**< Distance between the top of the underline and base line (< 0 means below the base line)*/
int8_t underline_thickness; /**< Thickness of the underline*/
const void * dsc; /**< Store implementation specific or run_time data or caching here*/
const lv_font_t * fallback; /**< Fallback font for missing glyph. Resolved recursively */
void * user_data; /**< Custom user data for font.*/
};
struct _lv_font_class_t {
lv_font_t * (*create_cb)(const lv_font_info_t * info, const void * src); /**< Font creation callback function*/
void (*delete_cb)(lv_font_t * font); /**< Font deletion callback function*/
void * (*dup_src_cb)(const void * src); /**< Font source duplication callback function*/
void (*free_src_cb)(void * src); /**< Font source free callback function*/
};
struct _lv_font_info_t {
const char * name; /**< Font name, used to distinguish different font resources*/
const lv_font_class_t * class_p; /**< Font backend implementation*/
uint32_t size; /**< Font size in pixel*/
uint32_t render_mode; /**< Font rendering mode, see `lv_freetype_font_render_mode_t`*/
uint32_t style; /**< Font style, see `lv_freetype_font_style_t`*/
lv_font_kerning_t kerning; /**< Font kerning, see `lv_font_kerning_t`*/
};
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Return with the bitmap of a font.
* It always converts the normal fonts to A8 format in a draw_buf with
* LV_DRAW_BUF_ALIGN and LV_DRAW_BUF_STRIDE_ALIGN
* @note You must call lv_font_get_glyph_dsc() to get `g_dsc` (lv_font_glyph_dsc_t)
* before you can call this function.
* @param g_dsc the glyph descriptor including which font to use, which supply the glyph_index
* and the format.
* @param draw_buf a draw buffer that can be used to store the bitmap of the glyph.
* @return pointer to the glyph's data.
* It can be a draw buffer for bitmap fonts or an image source for imgfonts.
*/
const void * lv_font_get_glyph_bitmap(lv_font_glyph_dsc_t * g_dsc, lv_draw_buf_t * draw_buf);
/**
* Return the bitmap as it is. It works only if the font stores the bitmap in
* a non-volitile memory.
* @param g_dsc the glyph descriptor including which font to use, which supply the glyph_index
* and the format.
* @return the bitmap as it is
*/
const void * lv_font_get_glyph_static_bitmap(lv_font_glyph_dsc_t * g_dsc);
/**
* Get the descriptor of a glyph
* @param font pointer to font
* @param dsc_out store the result descriptor here
* @param letter a UNICODE letter code
* @param letter_next the next letter after `letter`. Used for kerning
* @return true: descriptor is successfully loaded into `dsc_out`.
* false: the letter was not found, no data is loaded to `dsc_out`
*/
bool lv_font_get_glyph_dsc(const lv_font_t * font, lv_font_glyph_dsc_t * dsc_out, uint32_t letter,
uint32_t letter_next);
/**
* Release the bitmap of a font.
* @note You must call lv_font_get_glyph_dsc() to get `g_dsc` (lv_font_glyph_dsc_t) before you can call this function.
* @param g_dsc the glyph descriptor including which font to use, which supply the glyph_index and the format.
*/
void lv_font_glyph_release_draw_data(lv_font_glyph_dsc_t * g_dsc);
/**
* Get the width of a glyph with kerning
* @param font pointer to a font
* @param letter a UNICODE letter
* @param letter_next the next letter after `letter`. Used for kerning
* @return the width of the glyph
*/
uint16_t lv_font_get_glyph_width(const lv_font_t * font, uint32_t letter, uint32_t letter_next);
/**
* Get the line height of a font. All characters fit into this height
* @param font pointer to a font
* @return the height of a font
*/
int32_t lv_font_get_line_height(const lv_font_t * font);
/**
* Configure the use of kerning information stored in a font
* @param font pointer to a font
* @param kerning `LV_FONT_KERNING_NORMAL` (default) or `LV_FONT_KERNING_NONE`
*/
void lv_font_set_kerning(lv_font_t * font, lv_font_kerning_t kerning);
/**
* Get the default font, defined by LV_FONT_DEFAULT
* @return return pointer to the default font
*/
const lv_font_t * lv_font_get_default(void);
/**
* Compare font information.
* @param ft_info_1 font information 1.
* @param ft_info_2 font information 2.
* @return return true if the fonts are equal.
*/
bool lv_font_info_is_equal(const lv_font_info_t * ft_info_1, const lv_font_info_t * ft_info_2);
/**
* Checks if a font has a static rendering bitmap.
* @param font pointer to a font
* @return return true if the font has a bitmap generated for static rendering.
*/
bool lv_font_has_static_bitmap(const lv_font_t * font);
/**********************
* MACROS
**********************/
#define LV_FONT_DECLARE(font_name) LV_ATTRIBUTE_EXTERN_DATA extern const lv_font_t font_name;
#if LV_FONT_MONTSERRAT_8
LV_FONT_DECLARE(lv_font_montserrat_8)
#endif
#if LV_FONT_MONTSERRAT_10
LV_FONT_DECLARE(lv_font_montserrat_10)
#endif
#if LV_FONT_MONTSERRAT_12
LV_FONT_DECLARE(lv_font_montserrat_12)
#endif
#if LV_FONT_MONTSERRAT_14
LV_FONT_DECLARE(lv_font_montserrat_14)
#endif
#if LV_FONT_MONTSERRAT_16
LV_FONT_DECLARE(lv_font_montserrat_16)
#endif
#if LV_FONT_MONTSERRAT_18
LV_FONT_DECLARE(lv_font_montserrat_18)
#endif
#if LV_FONT_MONTSERRAT_20
LV_FONT_DECLARE(lv_font_montserrat_20)
#endif
#if LV_FONT_MONTSERRAT_22
LV_FONT_DECLARE(lv_font_montserrat_22)
#endif
#if LV_FONT_MONTSERRAT_24
LV_FONT_DECLARE(lv_font_montserrat_24)
#endif
#if LV_FONT_MONTSERRAT_26
LV_FONT_DECLARE(lv_font_montserrat_26)
#endif
#if LV_FONT_MONTSERRAT_28
LV_FONT_DECLARE(lv_font_montserrat_28)
#endif
#if LV_FONT_MONTSERRAT_30
LV_FONT_DECLARE(lv_font_montserrat_30)
#endif
#if LV_FONT_MONTSERRAT_32
LV_FONT_DECLARE(lv_font_montserrat_32)
#endif
#if LV_FONT_MONTSERRAT_34
LV_FONT_DECLARE(lv_font_montserrat_34)
#endif
#if LV_FONT_MONTSERRAT_36
LV_FONT_DECLARE(lv_font_montserrat_36)
#endif
#if LV_FONT_MONTSERRAT_38
LV_FONT_DECLARE(lv_font_montserrat_38)
#endif
#if LV_FONT_MONTSERRAT_40
LV_FONT_DECLARE(lv_font_montserrat_40)
#endif
#if LV_FONT_MONTSERRAT_42
LV_FONT_DECLARE(lv_font_montserrat_42)
#endif
#if LV_FONT_MONTSERRAT_44
LV_FONT_DECLARE(lv_font_montserrat_44)
#endif
#if LV_FONT_MONTSERRAT_46
LV_FONT_DECLARE(lv_font_montserrat_46)
#endif
#if LV_FONT_MONTSERRAT_48
LV_FONT_DECLARE(lv_font_montserrat_48)
#endif
#if LV_FONT_MONTSERRAT_28_COMPRESSED
LV_FONT_DECLARE(lv_font_montserrat_28_compressed)
#endif
#if LV_FONT_DEJAVU_16_PERSIAN_HEBREW
LV_FONT_DECLARE(lv_font_dejavu_16_persian_hebrew)
#endif
#if LV_FONT_SIMSUN_14_CJK
LV_FONT_DECLARE(lv_font_simsun_14_cjk)
#endif
#if LV_FONT_SIMSUN_16_CJK
LV_FONT_DECLARE(lv_font_simsun_16_cjk)
#endif
#if LV_FONT_SOURCE_HAN_SANS_SC_14_CJK
LV_FONT_DECLARE(lv_font_source_han_sans_sc_14_cjk)
#endif
#if LV_FONT_SOURCE_HAN_SANS_SC_16_CJK
LV_FONT_DECLARE(lv_font_source_han_sans_sc_16_cjk)
#endif
#if LV_FONT_UNSCII_8
LV_FONT_DECLARE(lv_font_unscii_8)
#endif
#if LV_FONT_UNSCII_16
LV_FONT_DECLARE(lv_font_unscii_16)
#endif
/*Declare the custom (user defined) fonts*/
#ifdef LV_FONT_CUSTOM_DECLARE
LV_FONT_CUSTOM_DECLARE
#endif
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*USE_FONT*/
File diff suppressed because it is too large Load Diff
+678
View File
@@ -0,0 +1,678 @@
/**
* @file lv_font_fmt_txt.c
*
*/
/*********************
* INCLUDES
*********************/
#include "lv_font.h"
#include "lv_font_fmt_txt_private.h"
#include "../core/lv_global.h"
#include "../misc/lv_assert.h"
#include "../misc/lv_types.h"
#include "../misc/lv_log.h"
#include "../misc/lv_utils.h"
#include "../stdlib/lv_mem.h"
/*********************
* DEFINES
*********************/
#if LV_USE_FONT_COMPRESSED
#define font_rle LV_GLOBAL_DEFAULT()->font_fmt_rle
#endif /*LV_USE_FONT_COMPRESSED*/
/**********************
* TYPEDEFS
**********************/
typedef struct {
uint32_t gid_left;
uint32_t gid_right;
} kern_pair_ref_t;
/**********************
* STATIC PROTOTYPES
**********************/
static uint32_t get_glyph_dsc_id(const lv_font_t * font, uint32_t letter);
static int8_t get_kern_value(const lv_font_t * font, uint32_t gid_left, uint32_t gid_right);
static int unicode_list_compare(const void * ref, const void * element);
static int kern_pair_8_compare(const void * ref, const void * element);
static int kern_pair_16_compare(const void * ref, const void * element);
#if LV_USE_FONT_COMPRESSED
static void decompress(const uint8_t * in, uint8_t * out, int32_t w, int32_t h, uint8_t bpp, bool prefilter);
static inline void decompress_line(uint8_t * out, int32_t w);
static inline uint8_t get_bits(const uint8_t * in, uint32_t bit_pos, uint8_t len);
static inline void rle_init(const uint8_t * in, uint8_t bpp);
static inline uint8_t rle_next(void);
#endif /*LV_USE_FONT_COMPRESSED*/
static lv_font_t * builtin_font_create_cb(const lv_font_info_t * info, const void * src);
static void builtin_font_delete_cb(lv_font_t * font);
static void * builtin_font_dup_src_cb(const void * src);
static void builtin_font_free_src_cb(void * src);
/**********************
* STATIC VARIABLES
**********************/
static const uint8_t opa4_table[16] = {0, 17, 34, 51,
68, 85, 102, 119,
136, 153, 170, 187,
204, 221, 238, 255
};
#if LV_USE_FONT_COMPRESSED
static const uint8_t opa3_table[8] = {0, 36, 73, 109, 146, 182, 218, 255};
#endif
static const uint8_t opa2_table[4] = {0, 85, 170, 255};
const lv_font_class_t lv_builtin_font_class = {
.create_cb = builtin_font_create_cb,
.delete_cb = builtin_font_delete_cb,
.dup_src_cb = builtin_font_dup_src_cb,
.free_src_cb = builtin_font_free_src_cb,
};
/**********************
* GLOBAL PROTOTYPES
**********************/
/**********************
* MACROS
**********************/
/**********************
* GLOBAL FUNCTIONS
**********************/
const void * lv_font_get_bitmap_fmt_txt(lv_font_glyph_dsc_t * g_dsc, lv_draw_buf_t * draw_buf)
{
const lv_font_t * font = g_dsc->resolved_font;
lv_font_fmt_txt_dsc_t * fdsc = (lv_font_fmt_txt_dsc_t *)font->dsc;
uint32_t gid = g_dsc->gid.index;
if(!gid) return NULL;
const lv_font_fmt_txt_glyph_dsc_t * gdsc = &fdsc->glyph_dsc[gid];
if(g_dsc->req_raw_bitmap) return &fdsc->glyph_bitmap[gdsc->bitmap_index];
uint8_t * bitmap_out = draw_buf->data;
int32_t gsize = (int32_t) gdsc->box_w * gdsc->box_h;
if(gsize == 0) return NULL;
uint16_t stride_in = g_dsc->stride;
if(fdsc->bitmap_format == LV_FONT_FMT_TXT_PLAIN) {
const uint8_t * bitmap_in = &fdsc->glyph_bitmap[gdsc->bitmap_index];
uint8_t * bitmap_out_tmp = bitmap_out;
int32_t i = 0;
int32_t x, y;
uint32_t stride_out = lv_draw_buf_width_to_stride(gdsc->box_w, LV_COLOR_FORMAT_A8);
if(fdsc->bpp == 1) {
for(y = 0; y < gdsc->box_h; y ++) {
uint16_t line_rem = stride_in != 0 ? stride_in : gdsc->box_w;
for(x = 0; x < gdsc->box_w; x++, i++) {
i = i & 0x7;
if(i == 0) bitmap_out_tmp[x] = (*bitmap_in) & 0x80 ? 0xff : 0x00;
else if(i == 1) bitmap_out_tmp[x] = (*bitmap_in) & 0x40 ? 0xff : 0x00;
else if(i == 2) bitmap_out_tmp[x] = (*bitmap_in) & 0x20 ? 0xff : 0x00;
else if(i == 3) bitmap_out_tmp[x] = (*bitmap_in) & 0x10 ? 0xff : 0x00;
else if(i == 4) bitmap_out_tmp[x] = (*bitmap_in) & 0x08 ? 0xff : 0x00;
else if(i == 5) bitmap_out_tmp[x] = (*bitmap_in) & 0x04 ? 0xff : 0x00;
else if(i == 6) bitmap_out_tmp[x] = (*bitmap_in) & 0x02 ? 0xff : 0x00;
else if(i == 7) {
bitmap_out_tmp[x] = (*bitmap_in) & 0x01 ? 0xff : 0x00;
line_rem--;
bitmap_in++;
}
}
/*Handle stride*/
if(stride_in) {
i = 0; /*If there is a stride start from the next byte in the next line*/
bitmap_in += line_rem;
}
bitmap_out_tmp += stride_out;
}
}
else if(fdsc->bpp == 2) {
for(y = 0; y < gdsc->box_h; y ++) {
uint16_t line_rem = stride_in != 0 ? stride_in : gdsc->box_w;
for(x = 0; x < gdsc->box_w; x++, i++) {
i = i & 0x3;
if(i == 0) bitmap_out_tmp[x] = opa2_table[(*bitmap_in) >> 6];
else if(i == 1) bitmap_out_tmp[x] = opa2_table[((*bitmap_in) >> 4) & 0x3];
else if(i == 2) bitmap_out_tmp[x] = opa2_table[((*bitmap_in) >> 2) & 0x3];
else if(i == 3) {
bitmap_out_tmp[x] = opa2_table[((*bitmap_in) >> 0) & 0x3];
line_rem--;
bitmap_in++;
}
}
/*Handle stride*/
if(stride_in) {
i = 0; /*If there is a stride start from the next byte in the next line*/
bitmap_in += line_rem;
}
bitmap_out_tmp += stride_out;
}
}
else if(fdsc->bpp == 4) {
for(y = 0; y < gdsc->box_h; y ++) {
uint16_t line_rem = stride_in != 0 ? stride_in : gdsc->box_w;
for(x = 0; x < gdsc->box_w; x++, i++) {
i = i & 0x1;
if(i == 0) {
bitmap_out_tmp[x] = opa4_table[(*bitmap_in) >> 4];
}
else if(i == 1) {
bitmap_out_tmp[x] = opa4_table[(*bitmap_in) & 0xF];
line_rem--;
bitmap_in++;
}
}
/*Handle stride*/
if(stride_in) {
i = 0; /*If there is a stride start from the next byte in the next line*/
bitmap_in += line_rem;
}
bitmap_out_tmp += stride_out;
}
}
else if(fdsc->bpp == 8) {
for(y = 0; y < gdsc->box_h; y ++) {
uint16_t line_rem = stride_in != 0 ? stride_in : gdsc->box_w;
for(x = 0; x < gdsc->box_w; x++, i++) {
bitmap_out_tmp[x] = *bitmap_in;
line_rem--;
bitmap_in++;
}
bitmap_out_tmp += stride_out;
bitmap_in += line_rem;
}
}
lv_draw_buf_flush_cache(draw_buf, NULL);
return draw_buf;
}
/*Handle compressed bitmap*/
else {
#if LV_USE_FONT_COMPRESSED
bool prefilter = fdsc->bitmap_format == LV_FONT_FMT_TXT_COMPRESSED;
decompress(&fdsc->glyph_bitmap[gdsc->bitmap_index], bitmap_out, gdsc->box_w, gdsc->box_h,
(uint8_t)fdsc->bpp, prefilter);
lv_draw_buf_flush_cache(draw_buf, NULL);
return draw_buf;
#else /*!LV_USE_FONT_COMPRESSED*/
LV_LOG_WARN("Compressed fonts is used but LV_USE_FONT_COMPRESSED is not enabled in lv_conf.h");
return NULL;
#endif
}
/*If not returned earlier then the letter is not found in this font*/
return NULL;
}
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)
{
/*It fixes a strange compiler optimization issue: https://github.com/lvgl/lvgl/issues/4370*/
bool is_tab = unicode_letter == '\t';
if(is_tab) {
unicode_letter = ' ';
}
lv_font_fmt_txt_dsc_t * fdsc = (lv_font_fmt_txt_dsc_t *)font->dsc;
uint32_t gid = get_glyph_dsc_id(font, unicode_letter);
if(!gid) return false;
int8_t kvalue = 0;
if(fdsc->kern_dsc) {
uint32_t gid_next = get_glyph_dsc_id(font, unicode_letter_next);
if(gid_next) {
kvalue = get_kern_value(font, gid, gid_next);
}
}
/*Put together a glyph dsc*/
const lv_font_fmt_txt_glyph_dsc_t * gdsc = &fdsc->glyph_dsc[gid];
int32_t kv = ((int32_t)((int32_t)kvalue * fdsc->kern_scale) >> 4);
uint32_t adv_w = gdsc->adv_w;
if(is_tab) adv_w *= 2;
adv_w += kv;
adv_w = (adv_w + (1 << 3)) >> 4;
dsc_out->adv_w = adv_w;
dsc_out->box_h = gdsc->box_h;
dsc_out->box_w = gdsc->box_w;
dsc_out->ofs_x = gdsc->ofs_x;
dsc_out->ofs_y = gdsc->ofs_y;
if(fdsc->stride == 0) dsc_out->stride = 0;
else {
/*e.g. font_dsc stride == 4 means align to 4 byte boundary.
*In glyph_dsc store the actual line length in bytes*/
dsc_out->stride = LV_ROUND_UP(dsc_out->box_w, fdsc->stride);
}
dsc_out->format = (uint8_t)fdsc->bpp;
dsc_out->is_placeholder = false;
dsc_out->gid.index = gid;
if(is_tab) dsc_out->box_w = dsc_out->box_w * 2;
return true;
}
/**********************
* STATIC FUNCTIONS
**********************/
static uint32_t get_glyph_dsc_id(const lv_font_t * font, uint32_t letter)
{
if(letter == '\0') return 0;
lv_font_fmt_txt_dsc_t * fdsc = (lv_font_fmt_txt_dsc_t *)font->dsc;
uint16_t i;
for(i = 0; i < fdsc->cmap_num; i++) {
/*Relative code point*/
uint32_t rcp = letter - fdsc->cmaps[i].range_start;
if(rcp >= fdsc->cmaps[i].range_length) continue;
uint32_t glyph_id = 0;
if(fdsc->cmaps[i].type == LV_FONT_FMT_TXT_CMAP_FORMAT0_TINY) {
glyph_id = fdsc->cmaps[i].glyph_id_start + rcp;
}
else if(fdsc->cmaps[i].type == LV_FONT_FMT_TXT_CMAP_FORMAT0_FULL) {
const uint8_t * gid_ofs_8 = fdsc->cmaps[i].glyph_id_ofs_list;
/* The first character is always valid and should have offset = 0
* However if a character is missing it also has offset=0.
* So if there is a 0 not on the first position then it's a missing character */
if(gid_ofs_8[rcp] == 0 && letter != fdsc->cmaps[i].range_start) continue;
glyph_id = fdsc->cmaps[i].glyph_id_start + gid_ofs_8[rcp];
}
else if(fdsc->cmaps[i].type == LV_FONT_FMT_TXT_CMAP_SPARSE_TINY) {
uint16_t key = rcp;
uint16_t * p = lv_utils_bsearch(&key, fdsc->cmaps[i].unicode_list, fdsc->cmaps[i].list_length,
sizeof(fdsc->cmaps[i].unicode_list[0]), unicode_list_compare);
if(p) {
lv_uintptr_t ofs = p - fdsc->cmaps[i].unicode_list;
glyph_id = fdsc->cmaps[i].glyph_id_start + (uint32_t) ofs;
}
}
else if(fdsc->cmaps[i].type == LV_FONT_FMT_TXT_CMAP_SPARSE_FULL) {
uint16_t key = rcp;
uint16_t * p = lv_utils_bsearch(&key, fdsc->cmaps[i].unicode_list, fdsc->cmaps[i].list_length,
sizeof(fdsc->cmaps[i].unicode_list[0]), unicode_list_compare);
if(p) {
lv_uintptr_t ofs = p - fdsc->cmaps[i].unicode_list;
const uint16_t * gid_ofs_16 = fdsc->cmaps[i].glyph_id_ofs_list;
glyph_id = fdsc->cmaps[i].glyph_id_start + gid_ofs_16[ofs];
}
}
return glyph_id;
}
return 0;
}
static int8_t get_kern_value(const lv_font_t * font, uint32_t gid_left, uint32_t gid_right)
{
lv_font_fmt_txt_dsc_t * fdsc = (lv_font_fmt_txt_dsc_t *)font->dsc;
int8_t value = 0;
if(fdsc->kern_classes == 0) {
/*Kern pairs*/
const lv_font_fmt_txt_kern_pair_t * kdsc = fdsc->kern_dsc;
if(kdsc->glyph_ids_size == 0) {
/*Use binary search to find the kern value.
*The pairs are ordered left_id first, then right_id secondly.*/
const uint16_t * g_ids = kdsc->glyph_ids;
kern_pair_ref_t g_id_both = {gid_left, gid_right};
uint16_t * kid_p = lv_utils_bsearch(&g_id_both, g_ids, kdsc->pair_cnt, 2, kern_pair_8_compare);
/*If the `g_id_both` were found get its index from the pointer*/
if(kid_p) {
lv_uintptr_t ofs = kid_p - g_ids;
value = kdsc->values[ofs];
}
}
else if(kdsc->glyph_ids_size == 1) {
/*Use binary search to find the kern value.
*The pairs are ordered left_id first, then right_id secondly.*/
const uint32_t * g_ids = kdsc->glyph_ids;
kern_pair_ref_t g_id_both = {gid_left, gid_right};
uint32_t * kid_p = lv_utils_bsearch(&g_id_both, g_ids, kdsc->pair_cnt, 4, kern_pair_16_compare);
/*If the `g_id_both` were found get its index from the pointer*/
if(kid_p) {
lv_uintptr_t ofs = kid_p - g_ids;
value = kdsc->values[ofs];
}
}
else {
/*Invalid value*/
}
}
else {
/*Kern classes*/
const lv_font_fmt_txt_kern_classes_t * kdsc = fdsc->kern_dsc;
uint8_t left_class = kdsc->left_class_mapping[gid_left];
uint8_t right_class = kdsc->right_class_mapping[gid_right];
/*If class = 0, kerning not exist for that glyph
*else got the value form `class_pair_values` 2D array*/
if(left_class > 0 && right_class > 0) {
value = kdsc->class_pair_values[(left_class - 1) * kdsc->right_class_cnt + (right_class - 1)];
}
}
return value;
}
static int kern_pair_8_compare(const void * ref, const void * element)
{
const kern_pair_ref_t * ref8_p = ref;
const uint8_t * element8_p = element;
/*If the MSB is different it will matter. If not return the diff. of the LSB*/
if(ref8_p->gid_left != element8_p[0]) return ref8_p->gid_left - element8_p[0];
else return ref8_p->gid_right - element8_p[1];
}
static int kern_pair_16_compare(const void * ref, const void * element)
{
const kern_pair_ref_t * ref16_p = ref;
const uint16_t * element16_p = element;
/*If the MSB is different it will matter. If not return the diff. of the LSB*/
if(ref16_p->gid_left != element16_p[0]) return ref16_p->gid_left - element16_p[0];
else return ref16_p->gid_right - element16_p[1];
}
#if LV_USE_FONT_COMPRESSED
/**
* The compress a glyph's bitmap
* @param in the compressed bitmap
* @param out buffer to store the result
* @param px_num number of pixels in the glyph (width * height)
* @param bpp bit per pixel (bpp = 3 will be converted to bpp = 4)
* @param prefilter true: the lines are XORed
*/
static void decompress(const uint8_t * in, uint8_t * out, int32_t w, int32_t h, uint8_t bpp, bool prefilter)
{
const lv_opa_t * opa_table;
switch(bpp) {
case 2:
opa_table = opa2_table;
break;
case 3:
opa_table = opa3_table;
break;
case 4:
opa_table = opa4_table;
break;
default:
LV_LOG_WARN("%d bpp is not handled", bpp);
return;
}
rle_init(in, bpp);
uint8_t * line_buf1 = lv_malloc(w);
uint8_t * line_buf2 = NULL;
if(prefilter) {
line_buf2 = lv_malloc(w);
}
decompress_line(line_buf1, w);
int32_t y;
int32_t x;
uint32_t stride = lv_draw_buf_width_to_stride(w, LV_COLOR_FORMAT_A8);
for(x = 0; x < w; x++) {
out[x] = opa_table[line_buf1[x]];
}
out += stride;
for(y = 1; y < h; y++) {
if(prefilter) {
decompress_line(line_buf2, w);
for(x = 0; x < w; x++) {
line_buf1[x] = line_buf2[x] ^ line_buf1[x];
out[x] = opa_table[line_buf1[x]];
}
}
else {
decompress_line(line_buf1, w);
for(x = 0; x < w; x++) {
out[x] = opa_table[line_buf1[x]];
}
}
out += stride;
}
lv_free(line_buf1);
lv_free(line_buf2);
}
/**
* Decompress one line. Store one pixel per byte
* @param out output buffer
* @param w width of the line in pixel count
*/
static inline void decompress_line(uint8_t * out, int32_t w)
{
int32_t i;
for(i = 0; i < w; i++) {
out[i] = rle_next();
}
}
/**
* Read bits from an input buffer. The read can cross byte boundary.
* @param in the input buffer to read from.
* @param bit_pos index of the first bit to read.
* @param len number of bits to read (must be <= 8).
* @return the read bits
*/
static inline uint8_t get_bits(const uint8_t * in, uint32_t bit_pos, uint8_t len)
{
uint8_t bit_mask;
switch(len) {
case 1:
bit_mask = 0x1;
break;
case 2:
bit_mask = 0x3;
break;
case 3:
bit_mask = 0x7;
break;
case 4:
bit_mask = 0xF;
break;
case 8:
bit_mask = 0xFF;
break;
default:
bit_mask = (uint16_t)((uint16_t) 1 << len) - 1;
}
uint32_t byte_pos = bit_pos >> 3;
bit_pos = bit_pos & 0x7;
if(bit_pos + len >= 8) {
uint16_t in16 = (in[byte_pos] << 8) + in[byte_pos + 1];
return (in16 >> (16 - bit_pos - len)) & bit_mask;
}
else {
return (in[byte_pos] >> (8 - bit_pos - len)) & bit_mask;
}
}
static inline void rle_init(const uint8_t * in, uint8_t bpp)
{
lv_font_fmt_rle_t * rle = &font_rle;
rle->in = in;
rle->bpp = bpp;
rle->state = RLE_STATE_SINGLE;
rle->rdp = 0;
rle->prev_v = 0;
rle->count = 0;
}
static inline uint8_t rle_next(void)
{
uint8_t v = 0;
uint8_t ret = 0;
lv_font_fmt_rle_t * rle = &font_rle;
if(rle->state == RLE_STATE_SINGLE) {
ret = get_bits(rle->in, rle->rdp, rle->bpp);
if(rle->rdp != 0 && rle->prev_v == ret) {
rle->count = 0;
rle->state = RLE_STATE_REPEATED;
}
rle->prev_v = ret;
rle->rdp += rle->bpp;
}
else if(rle->state == RLE_STATE_REPEATED) {
v = get_bits(rle->in, rle->rdp, 1);
rle->count++;
rle->rdp += 1;
if(v == 1) {
ret = rle->prev_v;
if(rle->count == 11) {
rle->count = get_bits(rle->in, rle->rdp, 6);
rle->rdp += 6;
if(rle->count != 0) {
rle->state = RLE_STATE_COUNTER;
}
else {
ret = get_bits(rle->in, rle->rdp, rle->bpp);
rle->prev_v = ret;
rle->rdp += rle->bpp;
rle->state = RLE_STATE_SINGLE;
}
}
}
else {
ret = get_bits(rle->in, rle->rdp, rle->bpp);
rle->prev_v = ret;
rle->rdp += rle->bpp;
rle->state = RLE_STATE_SINGLE;
}
}
else if(rle->state == RLE_STATE_COUNTER) {
ret = rle->prev_v;
rle->count--;
if(rle->count == 0) {
ret = get_bits(rle->in, rle->rdp, rle->bpp);
rle->prev_v = ret;
rle->rdp += rle->bpp;
rle->state = RLE_STATE_SINGLE;
}
}
return ret;
}
#endif /*LV_USE_FONT_COMPRESSED*/
/** Code Comparator.
*
* Compares the value of both input arguments.
*
* @param[in] pRef Pointer to the reference.
* @param[in] pElement Pointer to the element to compare.
*
* @return Result of comparison.
* @retval < 0 Reference is less than element.
* @retval = 0 Reference is equal to element.
* @retval > 0 Reference is greater than element.
*
*/
static int unicode_list_compare(const void * ref, const void * element)
{
return (*(uint16_t *)ref) - (*(uint16_t *)element);
}
static lv_font_t * builtin_font_create_cb(const lv_font_info_t * info, const void * src)
{
const lv_builtin_font_src_t * font_src = src;
/**
* If a crash occurs here, please check whether the last font in
* the lv_builtin_font_src array is set to NULL as required to mark the end of the array.
*/
while(font_src->font_p) {
if(info->size == font_src->size) {
return (lv_font_t *)font_src->font_p;
}
font_src++;
}
LV_LOG_WARN("No built-in font found with size: %" LV_PRIu32, info->size);
return NULL;
}
static void builtin_font_delete_cb(lv_font_t * font)
{
/*Nothing to delete*/
LV_UNUSED(font);
}
static void * builtin_font_dup_src_cb(const void * src)
{
const lv_builtin_font_src_t * font_src = src;
uint32_t len = 0;
/*Measure the size of the source data*/
/**
* If a crash occurs here, please check whether the last font in
* the lv_builtin_font_src array is set to NULL as required to mark the end of the array.
*/
while(font_src->font_p) {
len++;
font_src++;
}
if(len == 0) {
LV_LOG_WARN("No source data found");
return NULL;
}
lv_builtin_font_src_t * new_src = lv_malloc_zeroed(sizeof(lv_builtin_font_src_t) * (len + 1));
LV_ASSERT_MALLOC(new_src);
lv_memcpy(new_src, src, sizeof(lv_builtin_font_src_t) * len);
return new_src;
}
static void builtin_font_free_src_cb(void * src)
{
lv_free(src);
}
+239
View File
@@ -0,0 +1,239 @@
/**
* @file lv_font_fmt_txt.h
*
*/
#ifndef LV_FONT_FMT_TXT_H
#define LV_FONT_FMT_TXT_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "lv_font.h"
#include "../misc/lv_types.h"
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/** This describes a glyph.*/
typedef struct {
#if LV_FONT_FMT_TXT_LARGE == 0
uint32_t bitmap_index : 20; /**< Start index of the bitmap. A font can be max 1 MB.*/
uint32_t adv_w : 12; /**< Draw the next glyph after this width. 8.4 format (real_value * 16 is stored).*/
uint8_t box_w; /**< Width of the glyph's bounding box*/
uint8_t box_h; /**< Height of the glyph's bounding box*/
int8_t ofs_x; /**< x offset of the bounding box*/
int8_t ofs_y; /**< y offset of the bounding box. Measured from the top of the line*/
#else
uint32_t bitmap_index; /**< Start index of the bitmap. A font can be max 4 GB.*/
uint32_t adv_w; /**< Draw the next glyph after this width. 28.4 format (real_value * 16 is stored).*/
uint16_t box_w; /**< Width of the glyph's bounding box*/
uint16_t box_h; /**< Height of the glyph's bounding box*/
int16_t ofs_x; /**< x offset of the bounding box*/
int16_t ofs_y; /**< y offset of the bounding box. Measured from the top of the line*/
#endif
} lv_font_fmt_txt_glyph_dsc_t;
/** Format of font character map.*/
typedef enum {
LV_FONT_FMT_TXT_CMAP_FORMAT0_FULL,
LV_FONT_FMT_TXT_CMAP_SPARSE_FULL,
LV_FONT_FMT_TXT_CMAP_FORMAT0_TINY,
LV_FONT_FMT_TXT_CMAP_SPARSE_TINY,
} lv_font_fmt_txt_cmap_type_t;
/**
* Map codepoints to a `glyph_dsc`s
* Several formats are supported to optimize memory usage
* See https://github.com/lvgl/lv_font_conv/blob/master/doc/font_spec.md
*/
typedef struct {
/** First Unicode character for this range*/
uint32_t range_start;
/** Number of Unicode characters related to this range.
* Last Unicode character = range_start + range_length - 1*/
uint16_t range_length;
/** First glyph ID (array index of `glyph_dsc`) for this range*/
uint16_t glyph_id_start;
/*
According the specification there are 4 formats:
https://github.com/lvgl/lv_font_conv/blob/master/doc/font_spec.md
For simplicity introduce "relative code point":
rcp = codepoint - range_start
and a search function:
search a "value" in an "array" and returns the index of "value".
Format 0 tiny
unicode_list == NULL && glyph_id_ofs_list == NULL
glyph_id = glyph_id_start + rcp
Format 0 full
unicode_list == NULL && glyph_id_ofs_list != NULL
glyph_id = glyph_id_start + glyph_id_ofs_list[rcp]
Sparse tiny
unicode_list != NULL && glyph_id_ofs_list == NULL
glyph_id = glyph_id_start + search(unicode_list, rcp)
Sparse full
unicode_list != NULL && glyph_id_ofs_list != NULL
glyph_id = glyph_id_start + glyph_id_ofs_list[search(unicode_list, rcp)]
*/
const uint16_t * unicode_list;
/** if(type == LV_FONT_FMT_TXT_CMAP_FORMAT0_...) it's `uint8_t *`
* if(type == LV_FONT_FMT_TXT_CMAP_SPARSE_...) it's `uint16_t *`
*/
const void * glyph_id_ofs_list;
/** Length of `unicode_list` and/or `glyph_id_ofs_list`*/
uint16_t list_length;
/** Type of this character map*/
lv_font_fmt_txt_cmap_type_t type;
} lv_font_fmt_txt_cmap_t;
/** A simple mapping of kern values from pairs*/
typedef struct {
/*To get a kern value of two code points:
1. Get the `glyph_id_left` and `glyph_id_right` from `lv_font_fmt_txt_cmap_t
2. for(i = 0; i < pair_cnt * 2; i += 2)
if(glyph_ids[i] == glyph_id_left &&
glyph_ids[i+1] == glyph_id_right)
return values[i / 2];
*/
const void * glyph_ids;
const int8_t * values;
uint32_t pair_cnt : 30;
uint32_t glyph_ids_size : 2; /**< 0: `glyph_ids` is stored as `uint8_t`; 1: as `uint16_t` */
} lv_font_fmt_txt_kern_pair_t;
/** More complex but more optimal class based kern value storage*/
typedef struct {
/*To get a kern value of two code points:
1. Get the `glyph_id_left` and `glyph_id_right` from `lv_font_fmt_txt_cmap_t
2. Get the class of the left and right glyphs as `left_class` and `right_class`
left_class = left_class_mapping[glyph_id_left];
right_class = right_class_mapping[glyph_id_right];
3. value = class_pair_values[(left_class-1)*right_class_cnt + (right_class-1)]
*/
const int8_t * class_pair_values; /**< left_class_cnt * right_class_cnt value */
const uint8_t * left_class_mapping; /**< Map the glyph_ids to classes: index -> glyph_id -> class_id */
const uint8_t * right_class_mapping; /**< Map the glyph_ids to classes: index -> glyph_id -> class_id */
uint8_t left_class_cnt;
uint8_t right_class_cnt;
} lv_font_fmt_txt_kern_classes_t;
/** Bitmap formats*/
typedef enum {
LV_FONT_FMT_TXT_PLAIN = 0,
LV_FONT_FMT_TXT_COMPRESSED = 1,
LV_FONT_FMT_TXT_COMPRESSED_NO_PREFILTER = 2,
} lv_font_fmt_txt_bitmap_format_t;
/** Describe store for additional data for fonts */
typedef struct {
/** The bitmaps of all glyphs */
const uint8_t * glyph_bitmap;
/** Describe the glyphs */
const lv_font_fmt_txt_glyph_dsc_t * glyph_dsc;
/** Map the glyphs to Unicode characters.
*Array of `lv_font_cmap_fmt_txt_t` variables */
const lv_font_fmt_txt_cmap_t * cmaps;
/**
* Store kerning values.
* Can be `lv_font_fmt_txt_kern_pair_t * or `lv_font_kern_classes_fmt_txt_t *`
* depending on `kern_classes`
*/
const void * kern_dsc;
/** Scale kern values in 12.4 format */
uint16_t kern_scale;
/** Number of cmap tables */
uint16_t cmap_num : 9;
/** Bit per pixel: 1, 2, 3, 4, 8 */
uint16_t bpp : 4;
/** Type of `kern_dsc` */
uint16_t kern_classes : 1;
/**
* storage format of the bitmap
* from `lv_font_fmt_txt_bitmap_format_t`
*/
uint16_t bitmap_format : 2;
/**
* Bytes to which each line is padded.
* 0: means no align and padding
* 1: e.g. with bpp=4 lines are aligned to 1 byte, so there can be a 4 bits of padding
* 4, 8, 16, 32, 64: each line is padded to the given byte boundaries
*/
uint8_t stride;
} lv_font_fmt_txt_dsc_t;
typedef struct {
const lv_font_t * font_p; /**< Pointer to built-in font*/
uint32_t size; /** < Size of the built-in font*/
} lv_builtin_font_src_t;
LV_ATTRIBUTE_EXTERN_DATA extern const lv_font_class_t lv_builtin_font_class;
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Used as `get_glyph_bitmap` callback in lvgl's native font format if the font is uncompressed.
* @param g_dsc the glyph descriptor including which font to use, which supply the glyph_index and format.
* @param draw_buf a draw buffer that can be used to store the bitmap of the glyph, it's OK not to use it.
* @return pointer to an A8 bitmap (not necessarily bitmap_out) or NULL if `unicode_letter` not found
*/
const void * lv_font_get_bitmap_fmt_txt(lv_font_glyph_dsc_t * g_dsc, lv_draw_buf_t * draw_buf);
/**
* Used as `get_glyph_dsc` callback in lvgl's native font format if the font is uncompressed.
* @param font pointer to font
* @param dsc_out store the result descriptor here
* @param unicode_letter a UNICODE letter code
* @param unicode_letter_next the unicode letter succeeding the letter under test
* @return true: descriptor is successfully loaded into `dsc_out`.
* false: the letter was not found, no data is loaded to `dsc_out`
*/
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);
/**********************
* MACROS
**********************/
/**********************
* ADD BUILT IN FONTS
**********************/
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_FONT_FMT_TXT_H*/
@@ -0,0 +1,56 @@
/**
* @file lv_font_fmt_txt_private.h
*
*/
#ifndef LV_FONT_FMT_TXT_PRIVATE_H
#define LV_FONT_FMT_TXT_PRIVATE_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "lv_font_fmt_txt.h"
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
#if LV_USE_FONT_COMPRESSED
typedef enum {
RLE_STATE_SINGLE = 0,
RLE_STATE_REPEATED,
RLE_STATE_COUNTER,
} lv_font_fmt_rle_state_t;
typedef struct {
uint32_t rdp;
const uint8_t * in;
uint8_t bpp;
uint8_t prev_v;
uint8_t count;
lv_font_fmt_rle_state_t state;
} lv_font_fmt_rle_t;
#endif
/**********************
* GLOBAL PROTOTYPES
**********************/
/**********************
* MACROS
**********************/
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_FONT_FMT_TXT_PRIVATE_H*/
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+641
View File
@@ -0,0 +1,641 @@
/*******************************************************************************
* Size: 16 px
* Bpp: 1
* Opts: --no-compress --no-prefilter --bpp 1 --size 16 --font unscii-8.ttf -r 0x20-0x7F --format lvgl -o lv_font_unscii_16.c --force-fast-kern-format
******************************************************************************/
#ifdef LV_LVGL_H_INCLUDE_SIMPLE
#include "lvgl.h"
#else
#include "../../lvgl.h"
#endif
#ifndef LV_FONT_UNSCII_16
#define LV_FONT_UNSCII_16 1
#endif
#if LV_FONT_UNSCII_16
/*-----------------
* BITMAPS
*----------------*/
/*Store the image of the glyphs*/
static LV_ATTRIBUTE_LARGE_CONST const uint8_t glyph_bitmap[] = {
/* U+0020 " " */
0x0,
/* U+0021 "!" */
0xff, 0xff, 0xff, 0xff, 0xff, 0x0, 0xff,
/* U+0022 "\"" */
0xf0, 0xff, 0xf, 0xf0, 0xff, 0xf, 0xf0, 0xff,
0xf,
/* U+0023 "#" */
0x3c, 0xf0, 0xf3, 0xc3, 0xcf, 0xf, 0x3c, 0xff,
0xff, 0xff, 0xf3, 0xcf, 0xf, 0x3c, 0xff, 0xff,
0xff, 0xf3, 0xcf, 0xf, 0x3c, 0x3c, 0xf0, 0xf3,
0xc0,
/* U+0024 "$" */
0xf, 0x0, 0xf0, 0x3f, 0xf3, 0xff, 0xf0, 0xf,
0x0, 0x3f, 0xc3, 0xfc, 0x0, 0xf0, 0xf, 0xff,
0xcf, 0xfc, 0xf, 0x0, 0xf0,
/* U+0025 "%" */
0xf0, 0x3f, 0xc0, 0xff, 0xf, 0x3c, 0x3c, 0x3,
0xc0, 0xf, 0x0, 0xf0, 0x3, 0xc0, 0x3c, 0x3c,
0xf0, 0xff, 0x3, 0x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,
0x3f, 0xcc, 0xf3, 0xff, 0xf, 0xfc, 0x3c, 0xf0,
0xf3, 0xc0,
/* U+0078 "x" */
0xf0, 0x3f, 0xc0, 0xf3, 0xcf, 0xf, 0x3c, 0xf,
0xc0, 0x3f, 0x3, 0xcf, 0xf, 0x3c, 0xf0, 0x3f,
0xc0, 0xf0,
/* U+0079 "y" */
0xf0, 0xff, 0xf, 0xf0, 0xff, 0xf, 0xf0, 0xff,
0xf, 0x3f, 0xf3, 0xff, 0x0, 0xf0, 0xf, 0x3f,
0xc3, 0xfc,
/* U+007A "z" */
0xff, 0xff, 0xff, 0x3, 0xc0, 0x3c, 0xf, 0x0,
0xf0, 0x3c, 0x3, 0xc0, 0xff, 0xff, 0xff,
/* U+007B "{" */
0x3, 0xf0, 0x3f, 0xf, 0x0, 0xf0, 0xf, 0x0,
0xf0, 0xfc, 0xf, 0xc0, 0xf, 0x0, 0xf0, 0xf,
0x0, 0xf0, 0x3, 0xf0, 0x3f,
/* U+007C "|" */
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
/* U+007D "}" */
0xfc, 0xf, 0xc0, 0xf, 0x0, 0xf0, 0xf, 0x0,
0xf0, 0x3, 0xf0, 0x3f, 0xf, 0x0, 0xf0, 0xf,
0x0, 0xf0, 0xfc, 0xf, 0xc0,
/* U+007E "~" */
0x3f, 0x3c, 0xfc, 0xff, 0x3f, 0x3c, 0xfc,
/* U+007F "" */
0xf0, 0x3, 0xc0, 0xc, 0xc0, 0x33, 0x0, 0xcc,
0xff, 0x33, 0xfc, 0xc3, 0x33, 0xc, 0xf0, 0x33,
0xc0, 0xc0, 0x3, 0x0, 0xc, 0x0, 0x30, 0x0,
0xc0
};
/*---------------------
* GLYPH DESCRIPTION
*--------------------*/
static const lv_font_fmt_txt_glyph_dsc_t glyph_dsc[] = {
{.bitmap_index = 0, .adv_w = 0, .box_w = 0, .box_h = 0, .ofs_x = 0, .ofs_y = 0} /* id = 0 reserved */,
{.bitmap_index = 0, .adv_w = 256, .box_w = 1, .box_h = 1, .ofs_x = 0, .ofs_y = 16},
{.bitmap_index = 1, .adv_w = 256, .box_w = 4, .box_h = 14, .ofs_x = 6, .ofs_y = 2},
{.bitmap_index = 8, .adv_w = 256, .box_w = 12, .box_h = 6, .ofs_x = 2, .ofs_y = 10},
{.bitmap_index = 17, .adv_w = 256, .box_w = 14, .box_h = 14, .ofs_x = 0, .ofs_y = 2},
{.bitmap_index = 42, .adv_w = 256, .box_w = 12, .box_h = 14, .ofs_x = 2, .ofs_y = 2},
{.bitmap_index = 63, .adv_w = 256, .box_w = 14, .box_h = 12, .ofs_x = 0, .ofs_y = 2},
{.bitmap_index = 84, .adv_w = 256, .box_w = 14, .box_h = 14, .ofs_x = 0, .ofs_y = 2},
{.bitmap_index = 109, .adv_w = 256, .box_w = 6, .box_h = 6, .ofs_x = 4, .ofs_y = 10},
{.bitmap_index = 114, .adv_w = 256, .box_w = 8, .box_h = 14, .ofs_x = 4, .ofs_y = 2},
{.bitmap_index = 128, .adv_w = 256, .box_w = 8, .box_h = 14, .ofs_x = 4, .ofs_y = 2},
{.bitmap_index = 142, .adv_w = 256, .box_w = 16, .box_h = 10, .ofs_x = 0, .ofs_y = 4},
{.bitmap_index = 162, .adv_w = 256, .box_w = 12, .box_h = 10, .ofs_x = 2, .ofs_y = 4},
{.bitmap_index = 177, .adv_w = 256, .box_w = 6, .box_h = 6, .ofs_x = 4, .ofs_y = 0},
{.bitmap_index = 182, .adv_w = 256, .box_w = 12, .box_h = 2, .ofs_x = 2, .ofs_y = 8},
{.bitmap_index = 185, .adv_w = 256, .box_w = 4, .box_h = 4, .ofs_x = 6, .ofs_y = 2},
{.bitmap_index = 187, .adv_w = 256, .box_w = 16, .box_h = 14, .ofs_x = 0, .ofs_y = 2},
{.bitmap_index = 215, .adv_w = 256, .box_w = 12, .box_h = 14, .ofs_x = 2, .ofs_y = 2},
{.bitmap_index = 236, .adv_w = 256, .box_w = 12, .box_h = 14, .ofs_x = 2, .ofs_y = 2},
{.bitmap_index = 257, .adv_w = 256, .box_w = 12, .box_h = 14, .ofs_x = 2, .ofs_y = 2},
{.bitmap_index = 278, .adv_w = 256, .box_w = 12, .box_h = 14, .ofs_x = 2, .ofs_y = 2},
{.bitmap_index = 299, .adv_w = 256, .box_w = 14, .box_h = 14, .ofs_x = 0, .ofs_y = 2},
{.bitmap_index = 324, .adv_w = 256, .box_w = 12, .box_h = 14, .ofs_x = 2, .ofs_y = 2},
{.bitmap_index = 345, .adv_w = 256, .box_w = 12, .box_h = 14, .ofs_x = 2, .ofs_y = 2},
{.bitmap_index = 366, .adv_w = 256, .box_w = 12, .box_h = 14, .ofs_x = 2, .ofs_y = 2},
{.bitmap_index = 387, .adv_w = 256, .box_w = 12, .box_h = 14, .ofs_x = 2, .ofs_y = 2},
{.bitmap_index = 408, .adv_w = 256, .box_w = 12, .box_h = 14, .ofs_x = 2, .ofs_y = 2},
{.bitmap_index = 429, .adv_w = 256, .box_w = 4, .box_h = 12, .ofs_x = 6, .ofs_y = 2},
{.bitmap_index = 435, .adv_w = 256, .box_w = 6, .box_h = 14, .ofs_x = 4, .ofs_y = 0},
{.bitmap_index = 446, .adv_w = 256, .box_w = 10, .box_h = 14, .ofs_x = 2, .ofs_y = 2},
{.bitmap_index = 464, .adv_w = 256, .box_w = 12, .box_h = 6, .ofs_x = 2, .ofs_y = 6},
{.bitmap_index = 473, .adv_w = 256, .box_w = 10, .box_h = 14, .ofs_x = 2, .ofs_y = 2},
{.bitmap_index = 491, .adv_w = 256, .box_w = 12, .box_h = 14, .ofs_x = 2, .ofs_y = 2},
{.bitmap_index = 512, .adv_w = 256, .box_w = 14, .box_h = 14, .ofs_x = 0, .ofs_y = 2},
{.bitmap_index = 537, .adv_w = 256, .box_w = 12, .box_h = 14, .ofs_x = 2, .ofs_y = 2},
{.bitmap_index = 558, .adv_w = 256, .box_w = 12, .box_h = 14, .ofs_x = 2, .ofs_y = 2},
{.bitmap_index = 579, .adv_w = 256, .box_w = 12, .box_h = 14, .ofs_x = 2, .ofs_y = 2},
{.bitmap_index = 600, .adv_w = 256, .box_w = 12, .box_h = 14, .ofs_x = 2, .ofs_y = 2},
{.bitmap_index = 621, .adv_w = 256, .box_w = 12, .box_h = 14, .ofs_x = 2, .ofs_y = 2},
{.bitmap_index = 642, .adv_w = 256, .box_w = 12, .box_h = 14, .ofs_x = 2, .ofs_y = 2},
{.bitmap_index = 663, .adv_w = 256, .box_w = 12, .box_h = 14, .ofs_x = 2, .ofs_y = 2},
{.bitmap_index = 684, .adv_w = 256, .box_w = 12, .box_h = 14, .ofs_x = 2, .ofs_y = 2},
{.bitmap_index = 705, .adv_w = 256, .box_w = 12, .box_h = 14, .ofs_x = 2, .ofs_y = 2},
{.bitmap_index = 726, .adv_w = 256, .box_w = 12, .box_h = 14, .ofs_x = 2, .ofs_y = 2},
{.bitmap_index = 747, .adv_w = 256, .box_w = 14, .box_h = 14, .ofs_x = 0, .ofs_y = 2},
{.bitmap_index = 772, .adv_w = 256, .box_w = 12, .box_h = 14, .ofs_x = 2, .ofs_y = 2},
{.bitmap_index = 793, .adv_w = 256, .box_w = 14, .box_h = 14, .ofs_x = 0, .ofs_y = 2},
{.bitmap_index = 818, .adv_w = 256, .box_w = 14, .box_h = 14, .ofs_x = 0, .ofs_y = 2},
{.bitmap_index = 843, .adv_w = 256, .box_w = 12, .box_h = 14, .ofs_x = 2, .ofs_y = 2},
{.bitmap_index = 864, .adv_w = 256, .box_w = 12, .box_h = 14, .ofs_x = 2, .ofs_y = 2},
{.bitmap_index = 885, .adv_w = 256, .box_w = 12, .box_h = 14, .ofs_x = 2, .ofs_y = 2},
{.bitmap_index = 906, .adv_w = 256, .box_w = 12, .box_h = 14, .ofs_x = 2, .ofs_y = 2},
{.bitmap_index = 927, .adv_w = 256, .box_w = 12, .box_h = 14, .ofs_x = 2, .ofs_y = 2},
{.bitmap_index = 948, .adv_w = 256, .box_w = 12, .box_h = 14, .ofs_x = 2, .ofs_y = 2},
{.bitmap_index = 969, .adv_w = 256, .box_w = 12, .box_h = 14, .ofs_x = 2, .ofs_y = 2},
{.bitmap_index = 990, .adv_w = 256, .box_w = 12, .box_h = 14, .ofs_x = 2, .ofs_y = 2},
{.bitmap_index = 1011, .adv_w = 256, .box_w = 14, .box_h = 14, .ofs_x = 0, .ofs_y = 2},
{.bitmap_index = 1036, .adv_w = 256, .box_w = 16, .box_h = 14, .ofs_x = 0, .ofs_y = 2},
{.bitmap_index = 1064, .adv_w = 256, .box_w = 16, .box_h = 14, .ofs_x = 0, .ofs_y = 2},
{.bitmap_index = 1092, .adv_w = 256, .box_w = 12, .box_h = 14, .ofs_x = 2, .ofs_y = 2},
{.bitmap_index = 1113, .adv_w = 256, .box_w = 8, .box_h = 14, .ofs_x = 4, .ofs_y = 2},
{.bitmap_index = 1127, .adv_w = 256, .box_w = 16, .box_h = 14, .ofs_x = 0, .ofs_y = 2},
{.bitmap_index = 1155, .adv_w = 256, .box_w = 8, .box_h = 14, .ofs_x = 4, .ofs_y = 2},
{.bitmap_index = 1169, .adv_w = 256, .box_w = 14, .box_h = 8, .ofs_x = 0, .ofs_y = 8},
{.bitmap_index = 1183, .adv_w = 256, .box_w = 16, .box_h = 2, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 1187, .adv_w = 256, .box_w = 8, .box_h = 6, .ofs_x = 6, .ofs_y = 10},
{.bitmap_index = 1193, .adv_w = 256, .box_w = 12, .box_h = 10, .ofs_x = 2, .ofs_y = 2},
{.bitmap_index = 1208, .adv_w = 256, .box_w = 12, .box_h = 14, .ofs_x = 2, .ofs_y = 2},
{.bitmap_index = 1229, .adv_w = 256, .box_w = 10, .box_h = 10, .ofs_x = 2, .ofs_y = 2},
{.bitmap_index = 1242, .adv_w = 256, .box_w = 12, .box_h = 14, .ofs_x = 2, .ofs_y = 2},
{.bitmap_index = 1263, .adv_w = 256, .box_w = 12, .box_h = 10, .ofs_x = 2, .ofs_y = 2},
{.bitmap_index = 1278, .adv_w = 256, .box_w = 10, .box_h = 14, .ofs_x = 2, .ofs_y = 2},
{.bitmap_index = 1296, .adv_w = 256, .box_w = 12, .box_h = 12, .ofs_x = 2, .ofs_y = 0},
{.bitmap_index = 1314, .adv_w = 256, .box_w = 12, .box_h = 14, .ofs_x = 2, .ofs_y = 2},
{.bitmap_index = 1335, .adv_w = 256, .box_w = 10, .box_h = 14, .ofs_x = 4, .ofs_y = 2},
{.bitmap_index = 1353, .adv_w = 256, .box_w = 10, .box_h = 16, .ofs_x = 2, .ofs_y = 0},
{.bitmap_index = 1373, .adv_w = 256, .box_w = 12, .box_h = 14, .ofs_x = 2, .ofs_y = 2},
{.bitmap_index = 1394, .adv_w = 256, .box_w = 10, .box_h = 14, .ofs_x = 4, .ofs_y = 2},
{.bitmap_index = 1412, .adv_w = 256, .box_w = 14, .box_h = 10, .ofs_x = 0, .ofs_y = 2},
{.bitmap_index = 1430, .adv_w = 256, .box_w = 12, .box_h = 10, .ofs_x = 2, .ofs_y = 2},
{.bitmap_index = 1445, .adv_w = 256, .box_w = 12, .box_h = 10, .ofs_x = 2, .ofs_y = 2},
{.bitmap_index = 1460, .adv_w = 256, .box_w = 12, .box_h = 12, .ofs_x = 2, .ofs_y = 0},
{.bitmap_index = 1478, .adv_w = 256, .box_w = 12, .box_h = 12, .ofs_x = 2, .ofs_y = 0},
{.bitmap_index = 1496, .adv_w = 256, .box_w = 12, .box_h = 10, .ofs_x = 2, .ofs_y = 2},
{.bitmap_index = 1511, .adv_w = 256, .box_w = 12, .box_h = 10, .ofs_x = 2, .ofs_y = 2},
{.bitmap_index = 1526, .adv_w = 256, .box_w = 12, .box_h = 14, .ofs_x = 2, .ofs_y = 2},
{.bitmap_index = 1547, .adv_w = 256, .box_w = 12, .box_h = 10, .ofs_x = 2, .ofs_y = 2},
{.bitmap_index = 1562, .adv_w = 256, .box_w = 12, .box_h = 10, .ofs_x = 2, .ofs_y = 2},
{.bitmap_index = 1577, .adv_w = 256, .box_w = 14, .box_h = 10, .ofs_x = 0, .ofs_y = 2},
{.bitmap_index = 1595, .adv_w = 256, .box_w = 14, .box_h = 10, .ofs_x = 0, .ofs_y = 2},
{.bitmap_index = 1613, .adv_w = 256, .box_w = 12, .box_h = 12, .ofs_x = 2, .ofs_y = 0},
{.bitmap_index = 1631, .adv_w = 256, .box_w = 12, .box_h = 10, .ofs_x = 2, .ofs_y = 2},
{.bitmap_index = 1646, .adv_w = 256, .box_w = 12, .box_h = 14, .ofs_x = 2, .ofs_y = 2},
{.bitmap_index = 1667, .adv_w = 256, .box_w = 4, .box_h = 14, .ofs_x = 6, .ofs_y = 2},
{.bitmap_index = 1674, .adv_w = 256, .box_w = 12, .box_h = 14, .ofs_x = 2, .ofs_y = 2},
{.bitmap_index = 1695, .adv_w = 256, .box_w = 14, .box_h = 4, .ofs_x = 0, .ofs_y = 12},
{.bitmap_index = 1702, .adv_w = 256, .box_w = 14, .box_h = 14, .ofs_x = 0, .ofs_y = 2}
};
/*---------------------
* CHARACTER MAPPING
*--------------------*/
/*Collect the unicode lists and glyph_id offsets*/
static const lv_font_fmt_txt_cmap_t cmaps[] = {
{
.range_start = 32, .range_length = 96, .glyph_id_start = 1,
.unicode_list = NULL, .glyph_id_ofs_list = NULL, .list_length = 0, .type = LV_FONT_FMT_TXT_CMAP_FORMAT0_TINY
}
};
/*--------------------
* ALL CUSTOM DATA
*--------------------*/
#if LVGL_VERSION_MAJOR >= 8
/*Store all the custom data of the font*/
static const lv_font_fmt_txt_dsc_t font_dsc = {
#else
static lv_font_fmt_txt_dsc_t font_dsc = {
#endif
.glyph_bitmap = glyph_bitmap,
.glyph_dsc = glyph_dsc,
.cmaps = cmaps,
.kern_dsc = NULL,
.kern_scale = 0,
.cmap_num = 1,
.bpp = 1,
.kern_classes = 0,
.bitmap_format = 0,
};
/*-----------------
* PUBLIC FONT
*----------------*/
/*Initialize a public general font descriptor*/
#if LVGL_VERSION_MAJOR >= 8
const lv_font_t lv_font_unscii_16 = {
#else
lv_font_t lv_font_unscii_16 = {
#endif
.get_glyph_dsc = lv_font_get_glyph_dsc_fmt_txt, /*Function pointer to get glyph's data*/
.get_glyph_bitmap = lv_font_get_bitmap_fmt_txt, /*Function pointer to get glyph's bitmap*/
.line_height = 17, /*The maximum line height required by the font*/
.base_line = 0, /*Baseline measured from the bottom of the line*/
#if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0)
.subpx = LV_FONT_SUBPX_NONE,
#endif
#if LV_VERSION_CHECK(7, 4, 0) || LVGL_VERSION_MAJOR >= 8
.underline_position = 0,
.underline_thickness = 0,
#endif
.dsc = &font_dsc /*The custom font data. Will be accessed by `get_glyph_bitmap/dsc` */
};
#endif /*#if LV_FONT_UNSCII_16*/
+477
View File
@@ -0,0 +1,477 @@
/*******************************************************************************
* Size: 8 px
* Bpp: 1
* Opts: --no-compress --no-prefilter --bpp 1 --size 8 --font unscii-8.ttf -r 0x20-0x7F --format lvgl -o lv_font_unscii_8.c --force-fast-kern-format
******************************************************************************/
#ifdef LV_LVGL_H_INCLUDE_SIMPLE
#include "lvgl.h"
#else
#include "../../lvgl.h"
#endif
#ifndef LV_FONT_UNSCII_8
#define LV_FONT_UNSCII_8 1
#endif
#if LV_FONT_UNSCII_8
/*-----------------
* BITMAPS
*----------------*/
/*Store the image of the glyphs*/
static LV_ATTRIBUTE_LARGE_CONST const uint8_t glyph_bitmap[] = {
/* U+0020 " " */
0x0,
/* U+0021 "!" */
0xff, 0xcc,
/* U+0022 "\"" */
0xcf, 0x3c, 0xc0,
/* U+0023 "#" */
0x6c, 0xdb, 0xfb, 0x6f, 0xed, 0x9b, 0x0,
/* U+0024 "$" */
0x31, 0xfc, 0x1e, 0xf, 0xe3, 0x0,
/* U+0025 "%" */
0xc7, 0x98, 0x61, 0x86, 0x78, 0xc0,
/* U+0026 "&" */
0x38, 0xd8, 0xe3, 0xbd, 0xd9, 0x9d, 0x80,
/* U+0027 "'" */
0x6f, 0x0,
/* U+0028 "(" */
0x36, 0xcc, 0xc6, 0x30,
/* U+0029 ")" */
0xc6, 0x33, 0x36, 0xc0,
/* U+002A "*" */
0x66, 0x3c, 0xff, 0x3c, 0x66,
/* U+002B "+" */
0x30, 0xcf, 0xcc, 0x30,
/* U+002C "," */
0x6f, 0x0,
/* U+002D "-" */
0xfc,
/* U+002E "." */
0xf0,
/* U+002F "/" */
0x3, 0x6, 0xc, 0x18, 0x30, 0x60, 0xc0,
/* U+0030 "0" */
0x7b, 0x3d, 0xfb, 0xcf, 0x37, 0x80,
/* U+0031 "1" */
0x31, 0xc3, 0xc, 0x30, 0xcf, 0xc0,
/* U+0032 "2" */
0x7b, 0x31, 0x8c, 0x63, 0xf, 0xc0,
/* U+0033 "3" */
0x7b, 0x30, 0xce, 0xf, 0x37, 0x80,
/* U+0034 "4" */
0x1c, 0x79, 0xb6, 0x6f, 0xe1, 0x83, 0x0,
/* U+0035 "5" */
0xff, 0xf, 0x83, 0xf, 0x37, 0x80,
/* U+0036 "6" */
0x39, 0x8c, 0x3e, 0xcf, 0x37, 0x80,
/* U+0037 "7" */
0xfc, 0x30, 0xc6, 0x30, 0xc3, 0x0,
/* U+0038 "8" */
0x7b, 0x3c, 0xde, 0xcf, 0x37, 0x80,
/* U+0039 "9" */
0x7b, 0x3c, 0xdf, 0xc, 0x67, 0x0,
/* U+003A ":" */
0xf0, 0xf0,
/* U+003B ";" */
0x6c, 0x6, 0xf0,
/* U+003C "<" */
0x19, 0x99, 0x86, 0x18, 0x60,
/* U+003D "=" */
0xfc, 0xf, 0xc0,
/* U+003E ">" */
0xc3, 0xc, 0x33, 0x33, 0x0,
/* U+003F "?" */
0x7b, 0x30, 0xc6, 0x30, 0x3, 0x0,
/* U+0040 "@" */
0x7d, 0x8f, 0x7e, 0xfd, 0xf8, 0x1f, 0x0,
/* U+0041 "A" */
0x31, 0xec, 0xf3, 0xff, 0x3c, 0xc0,
/* U+0042 "B" */
0xfb, 0x3c, 0xfe, 0xcf, 0x3f, 0x80,
/* U+0043 "C" */
0x7b, 0x3c, 0x30, 0xc3, 0x37, 0x80,
/* U+0044 "D" */
0xf3, 0x6c, 0xf3, 0xcf, 0x6f, 0x0,
/* U+0045 "E" */
0xff, 0xc, 0x3e, 0xc3, 0xf, 0xc0,
/* U+0046 "F" */
0xff, 0xc, 0x3e, 0xc3, 0xc, 0x0,
/* U+0047 "G" */
0x7b, 0x3c, 0x37, 0xcf, 0x37, 0xc0,
/* U+0048 "H" */
0xcf, 0x3c, 0xff, 0xcf, 0x3c, 0xc0,
/* U+0049 "I" */
0xfc, 0xc3, 0xc, 0x30, 0xcf, 0xc0,
/* U+004A "J" */
0xc, 0x30, 0xc3, 0xf, 0x37, 0x80,
/* U+004B "K" */
0xc7, 0x9b, 0x67, 0x8d, 0x99, 0xb1, 0x80,
/* U+004C "L" */
0xc3, 0xc, 0x30, 0xc3, 0xf, 0xc0,
/* U+004D "M" */
0xc7, 0xdf, 0xfe, 0xbc, 0x78, 0xf1, 0x80,
/* U+004E "N" */
0xc7, 0xcf, 0xde, 0xfc, 0xf8, 0xf1, 0x80,
/* U+004F "O" */
0x7b, 0x3c, 0xf3, 0xcf, 0x37, 0x80,
/* U+0050 "P" */
0xfb, 0x3c, 0xfe, 0xc3, 0xc, 0x0,
/* U+0051 "Q" */
0x7b, 0x3c, 0xf3, 0xcf, 0x66, 0xc0,
/* U+0052 "R" */
0xfb, 0x3c, 0xfe, 0xdb, 0x3c, 0xc0,
/* U+0053 "S" */
0x7b, 0x3c, 0x1e, 0xf, 0x37, 0x80,
/* U+0054 "T" */
0xfc, 0xc3, 0xc, 0x30, 0xc3, 0x0,
/* U+0055 "U" */
0xcf, 0x3c, 0xf3, 0xcf, 0x37, 0x80,
/* U+0056 "V" */
0xcf, 0x3c, 0xf3, 0xcd, 0xe3, 0x0,
/* U+0057 "W" */
0xc7, 0x8f, 0x1e, 0xbf, 0xfd, 0xf1, 0x80,
/* U+0058 "X" */
0xc3, 0x66, 0x3c, 0x18, 0x3c, 0x66, 0xc3,
/* U+0059 "Y" */
0xc3, 0x66, 0x3c, 0x18, 0x18, 0x18, 0x18,
/* U+005A "Z" */
0xfc, 0x31, 0x8c, 0x63, 0xf, 0xc0,
/* U+005B "[" */
0xfc, 0xcc, 0xcc, 0xf0,
/* U+005C "\\" */
0xc0, 0x60, 0x30, 0x18, 0xc, 0x6, 0x3,
/* U+005D "]" */
0xf3, 0x33, 0x33, 0xf0,
/* U+005E "^" */
0x10, 0x71, 0xb6, 0x30,
/* U+005F "_" */
0xff,
/* U+0060 "`" */
0xc6, 0x30,
/* U+0061 "a" */
0x78, 0x37, 0xf3, 0x7c,
/* U+0062 "b" */
0xc3, 0xf, 0xb3, 0xcf, 0x3f, 0x80,
/* U+0063 "c" */
0x7e, 0x31, 0x87, 0x80,
/* U+0064 "d" */
0xc, 0x37, 0xf3, 0xcf, 0x37, 0xc0,
/* U+0065 "e" */
0x7b, 0x3f, 0xf0, 0x78,
/* U+0066 "f" */
0x3b, 0x3e, 0xc6, 0x31, 0x80,
/* U+0067 "g" */
0x7f, 0x3c, 0xdf, 0xf, 0xe0,
/* U+0068 "h" */
0xc3, 0xf, 0xb3, 0xcf, 0x3c, 0xc0,
/* U+0069 "i" */
0x60, 0x38, 0xc6, 0x31, 0xe0,
/* U+006A "j" */
0x18, 0x6, 0x31, 0x8c, 0x7e,
/* U+006B "k" */
0xc3, 0xc, 0xf6, 0xf3, 0x6c, 0xc0,
/* U+006C "l" */
0xe3, 0x18, 0xc6, 0x31, 0xe0,
/* U+006D "m" */
0xcd, 0xff, 0x5e, 0xbc, 0x60,
/* U+006E "n" */
0xfb, 0x3c, 0xf3, 0xcc,
/* U+006F "o" */
0x7b, 0x3c, 0xf3, 0x78,
/* U+0070 "p" */
0xfb, 0x3c, 0xfe, 0xc3, 0x0,
/* U+0071 "q" */
0x7f, 0x3c, 0xdf, 0xc, 0x30,
/* U+0072 "r" */
0xfb, 0x3c, 0x30, 0xc0,
/* U+0073 "s" */
0x7f, 0x7, 0x83, 0xf8,
/* U+0074 "t" */
0x61, 0x8f, 0xd8, 0x61, 0x83, 0xc0,
/* U+0075 "u" */
0xcf, 0x3c, 0xf3, 0x7c,
/* U+0076 "v" */
0xcf, 0x3c, 0xde, 0x30,
/* U+0077 "w" */
0xc7, 0x8f, 0x5b, 0xe6, 0xc0,
/* U+0078 "x" */
0xc6, 0xd8, 0xe3, 0x6c, 0x60,
/* U+0079 "y" */
0xcf, 0x3c, 0xdf, 0xd, 0xe0,
/* U+007A "z" */
0xfc, 0x63, 0x18, 0xfc,
/* U+007B "{" */
0x1c, 0xc3, 0x38, 0x30, 0xc1, 0xc0,
/* U+007C "|" */
0xff, 0xfc,
/* U+007D "}" */
0xe0, 0xc3, 0x7, 0x30, 0xce, 0x0,
/* U+007E "~" */
0x77, 0xb8,
/* U+007F "" */
0xc1, 0x42, 0xbd, 0x2c, 0x40, 0x81, 0x0
};
/*---------------------
* GLYPH DESCRIPTION
*--------------------*/
static const lv_font_fmt_txt_glyph_dsc_t glyph_dsc[] = {
{.bitmap_index = 0, .adv_w = 0, .box_w = 0, .box_h = 0, .ofs_x = 0, .ofs_y = 0} /* id = 0 reserved */,
{.bitmap_index = 0, .adv_w = 128, .box_w = 1, .box_h = 1, .ofs_x = 0, .ofs_y = 8},
{.bitmap_index = 1, .adv_w = 128, .box_w = 2, .box_h = 7, .ofs_x = 3, .ofs_y = 1},
{.bitmap_index = 3, .adv_w = 128, .box_w = 6, .box_h = 3, .ofs_x = 1, .ofs_y = 5},
{.bitmap_index = 6, .adv_w = 128, .box_w = 7, .box_h = 7, .ofs_x = 0, .ofs_y = 1},
{.bitmap_index = 13, .adv_w = 128, .box_w = 6, .box_h = 7, .ofs_x = 1, .ofs_y = 1},
{.bitmap_index = 19, .adv_w = 128, .box_w = 7, .box_h = 6, .ofs_x = 0, .ofs_y = 1},
{.bitmap_index = 25, .adv_w = 128, .box_w = 7, .box_h = 7, .ofs_x = 0, .ofs_y = 1},
{.bitmap_index = 32, .adv_w = 128, .box_w = 3, .box_h = 3, .ofs_x = 2, .ofs_y = 5},
{.bitmap_index = 34, .adv_w = 128, .box_w = 4, .box_h = 7, .ofs_x = 2, .ofs_y = 1},
{.bitmap_index = 38, .adv_w = 128, .box_w = 4, .box_h = 7, .ofs_x = 2, .ofs_y = 1},
{.bitmap_index = 42, .adv_w = 128, .box_w = 8, .box_h = 5, .ofs_x = 0, .ofs_y = 2},
{.bitmap_index = 47, .adv_w = 128, .box_w = 6, .box_h = 5, .ofs_x = 1, .ofs_y = 2},
{.bitmap_index = 51, .adv_w = 128, .box_w = 3, .box_h = 3, .ofs_x = 2, .ofs_y = 0},
{.bitmap_index = 53, .adv_w = 128, .box_w = 6, .box_h = 1, .ofs_x = 1, .ofs_y = 4},
{.bitmap_index = 54, .adv_w = 128, .box_w = 2, .box_h = 2, .ofs_x = 3, .ofs_y = 1},
{.bitmap_index = 55, .adv_w = 128, .box_w = 8, .box_h = 7, .ofs_x = 0, .ofs_y = 1},
{.bitmap_index = 62, .adv_w = 128, .box_w = 6, .box_h = 7, .ofs_x = 1, .ofs_y = 1},
{.bitmap_index = 68, .adv_w = 128, .box_w = 6, .box_h = 7, .ofs_x = 1, .ofs_y = 1},
{.bitmap_index = 74, .adv_w = 128, .box_w = 6, .box_h = 7, .ofs_x = 1, .ofs_y = 1},
{.bitmap_index = 80, .adv_w = 128, .box_w = 6, .box_h = 7, .ofs_x = 1, .ofs_y = 1},
{.bitmap_index = 86, .adv_w = 128, .box_w = 7, .box_h = 7, .ofs_x = 0, .ofs_y = 1},
{.bitmap_index = 93, .adv_w = 128, .box_w = 6, .box_h = 7, .ofs_x = 1, .ofs_y = 1},
{.bitmap_index = 99, .adv_w = 128, .box_w = 6, .box_h = 7, .ofs_x = 1, .ofs_y = 1},
{.bitmap_index = 105, .adv_w = 128, .box_w = 6, .box_h = 7, .ofs_x = 1, .ofs_y = 1},
{.bitmap_index = 111, .adv_w = 128, .box_w = 6, .box_h = 7, .ofs_x = 1, .ofs_y = 1},
{.bitmap_index = 117, .adv_w = 128, .box_w = 6, .box_h = 7, .ofs_x = 1, .ofs_y = 1},
{.bitmap_index = 123, .adv_w = 128, .box_w = 2, .box_h = 6, .ofs_x = 3, .ofs_y = 1},
{.bitmap_index = 125, .adv_w = 128, .box_w = 3, .box_h = 7, .ofs_x = 2, .ofs_y = 0},
{.bitmap_index = 128, .adv_w = 128, .box_w = 5, .box_h = 7, .ofs_x = 1, .ofs_y = 1},
{.bitmap_index = 133, .adv_w = 128, .box_w = 6, .box_h = 3, .ofs_x = 1, .ofs_y = 3},
{.bitmap_index = 136, .adv_w = 128, .box_w = 5, .box_h = 7, .ofs_x = 1, .ofs_y = 1},
{.bitmap_index = 141, .adv_w = 128, .box_w = 6, .box_h = 7, .ofs_x = 1, .ofs_y = 1},
{.bitmap_index = 147, .adv_w = 128, .box_w = 7, .box_h = 7, .ofs_x = 0, .ofs_y = 1},
{.bitmap_index = 154, .adv_w = 128, .box_w = 6, .box_h = 7, .ofs_x = 1, .ofs_y = 1},
{.bitmap_index = 160, .adv_w = 128, .box_w = 6, .box_h = 7, .ofs_x = 1, .ofs_y = 1},
{.bitmap_index = 166, .adv_w = 128, .box_w = 6, .box_h = 7, .ofs_x = 1, .ofs_y = 1},
{.bitmap_index = 172, .adv_w = 128, .box_w = 6, .box_h = 7, .ofs_x = 1, .ofs_y = 1},
{.bitmap_index = 178, .adv_w = 128, .box_w = 6, .box_h = 7, .ofs_x = 1, .ofs_y = 1},
{.bitmap_index = 184, .adv_w = 128, .box_w = 6, .box_h = 7, .ofs_x = 1, .ofs_y = 1},
{.bitmap_index = 190, .adv_w = 128, .box_w = 6, .box_h = 7, .ofs_x = 1, .ofs_y = 1},
{.bitmap_index = 196, .adv_w = 128, .box_w = 6, .box_h = 7, .ofs_x = 1, .ofs_y = 1},
{.bitmap_index = 202, .adv_w = 128, .box_w = 6, .box_h = 7, .ofs_x = 1, .ofs_y = 1},
{.bitmap_index = 208, .adv_w = 128, .box_w = 6, .box_h = 7, .ofs_x = 1, .ofs_y = 1},
{.bitmap_index = 214, .adv_w = 128, .box_w = 7, .box_h = 7, .ofs_x = 0, .ofs_y = 1},
{.bitmap_index = 221, .adv_w = 128, .box_w = 6, .box_h = 7, .ofs_x = 1, .ofs_y = 1},
{.bitmap_index = 227, .adv_w = 128, .box_w = 7, .box_h = 7, .ofs_x = 0, .ofs_y = 1},
{.bitmap_index = 234, .adv_w = 128, .box_w = 7, .box_h = 7, .ofs_x = 0, .ofs_y = 1},
{.bitmap_index = 241, .adv_w = 128, .box_w = 6, .box_h = 7, .ofs_x = 1, .ofs_y = 1},
{.bitmap_index = 247, .adv_w = 128, .box_w = 6, .box_h = 7, .ofs_x = 1, .ofs_y = 1},
{.bitmap_index = 253, .adv_w = 128, .box_w = 6, .box_h = 7, .ofs_x = 1, .ofs_y = 1},
{.bitmap_index = 259, .adv_w = 128, .box_w = 6, .box_h = 7, .ofs_x = 1, .ofs_y = 1},
{.bitmap_index = 265, .adv_w = 128, .box_w = 6, .box_h = 7, .ofs_x = 1, .ofs_y = 1},
{.bitmap_index = 271, .adv_w = 128, .box_w = 6, .box_h = 7, .ofs_x = 1, .ofs_y = 1},
{.bitmap_index = 277, .adv_w = 128, .box_w = 6, .box_h = 7, .ofs_x = 1, .ofs_y = 1},
{.bitmap_index = 283, .adv_w = 128, .box_w = 6, .box_h = 7, .ofs_x = 1, .ofs_y = 1},
{.bitmap_index = 289, .adv_w = 128, .box_w = 7, .box_h = 7, .ofs_x = 0, .ofs_y = 1},
{.bitmap_index = 296, .adv_w = 128, .box_w = 8, .box_h = 7, .ofs_x = 0, .ofs_y = 1},
{.bitmap_index = 303, .adv_w = 128, .box_w = 8, .box_h = 7, .ofs_x = 0, .ofs_y = 1},
{.bitmap_index = 310, .adv_w = 128, .box_w = 6, .box_h = 7, .ofs_x = 1, .ofs_y = 1},
{.bitmap_index = 316, .adv_w = 128, .box_w = 4, .box_h = 7, .ofs_x = 2, .ofs_y = 1},
{.bitmap_index = 320, .adv_w = 128, .box_w = 8, .box_h = 7, .ofs_x = 0, .ofs_y = 1},
{.bitmap_index = 327, .adv_w = 128, .box_w = 4, .box_h = 7, .ofs_x = 2, .ofs_y = 1},
{.bitmap_index = 331, .adv_w = 128, .box_w = 7, .box_h = 4, .ofs_x = 0, .ofs_y = 4},
{.bitmap_index = 335, .adv_w = 128, .box_w = 8, .box_h = 1, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 336, .adv_w = 128, .box_w = 4, .box_h = 3, .ofs_x = 3, .ofs_y = 5},
{.bitmap_index = 338, .adv_w = 128, .box_w = 6, .box_h = 5, .ofs_x = 1, .ofs_y = 1},
{.bitmap_index = 342, .adv_w = 128, .box_w = 6, .box_h = 7, .ofs_x = 1, .ofs_y = 1},
{.bitmap_index = 348, .adv_w = 128, .box_w = 5, .box_h = 5, .ofs_x = 1, .ofs_y = 1},
{.bitmap_index = 352, .adv_w = 128, .box_w = 6, .box_h = 7, .ofs_x = 1, .ofs_y = 1},
{.bitmap_index = 358, .adv_w = 128, .box_w = 6, .box_h = 5, .ofs_x = 1, .ofs_y = 1},
{.bitmap_index = 362, .adv_w = 128, .box_w = 5, .box_h = 7, .ofs_x = 1, .ofs_y = 1},
{.bitmap_index = 367, .adv_w = 128, .box_w = 6, .box_h = 6, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 372, .adv_w = 128, .box_w = 6, .box_h = 7, .ofs_x = 1, .ofs_y = 1},
{.bitmap_index = 378, .adv_w = 128, .box_w = 5, .box_h = 7, .ofs_x = 2, .ofs_y = 1},
{.bitmap_index = 383, .adv_w = 128, .box_w = 5, .box_h = 8, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 388, .adv_w = 128, .box_w = 6, .box_h = 7, .ofs_x = 1, .ofs_y = 1},
{.bitmap_index = 394, .adv_w = 128, .box_w = 5, .box_h = 7, .ofs_x = 2, .ofs_y = 1},
{.bitmap_index = 399, .adv_w = 128, .box_w = 7, .box_h = 5, .ofs_x = 0, .ofs_y = 1},
{.bitmap_index = 404, .adv_w = 128, .box_w = 6, .box_h = 5, .ofs_x = 1, .ofs_y = 1},
{.bitmap_index = 408, .adv_w = 128, .box_w = 6, .box_h = 5, .ofs_x = 1, .ofs_y = 1},
{.bitmap_index = 412, .adv_w = 128, .box_w = 6, .box_h = 6, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 417, .adv_w = 128, .box_w = 6, .box_h = 6, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 422, .adv_w = 128, .box_w = 6, .box_h = 5, .ofs_x = 1, .ofs_y = 1},
{.bitmap_index = 426, .adv_w = 128, .box_w = 6, .box_h = 5, .ofs_x = 1, .ofs_y = 1},
{.bitmap_index = 430, .adv_w = 128, .box_w = 6, .box_h = 7, .ofs_x = 1, .ofs_y = 1},
{.bitmap_index = 436, .adv_w = 128, .box_w = 6, .box_h = 5, .ofs_x = 1, .ofs_y = 1},
{.bitmap_index = 440, .adv_w = 128, .box_w = 6, .box_h = 5, .ofs_x = 1, .ofs_y = 1},
{.bitmap_index = 444, .adv_w = 128, .box_w = 7, .box_h = 5, .ofs_x = 0, .ofs_y = 1},
{.bitmap_index = 449, .adv_w = 128, .box_w = 7, .box_h = 5, .ofs_x = 0, .ofs_y = 1},
{.bitmap_index = 454, .adv_w = 128, .box_w = 6, .box_h = 6, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 459, .adv_w = 128, .box_w = 6, .box_h = 5, .ofs_x = 1, .ofs_y = 1},
{.bitmap_index = 463, .adv_w = 128, .box_w = 6, .box_h = 7, .ofs_x = 1, .ofs_y = 1},
{.bitmap_index = 469, .adv_w = 128, .box_w = 2, .box_h = 7, .ofs_x = 3, .ofs_y = 1},
{.bitmap_index = 471, .adv_w = 128, .box_w = 6, .box_h = 7, .ofs_x = 1, .ofs_y = 1},
{.bitmap_index = 477, .adv_w = 128, .box_w = 7, .box_h = 2, .ofs_x = 0, .ofs_y = 6},
{.bitmap_index = 479, .adv_w = 128, .box_w = 7, .box_h = 7, .ofs_x = 0, .ofs_y = 1}
};
/*---------------------
* CHARACTER MAPPING
*--------------------*/
/*Collect the unicode lists and glyph_id offsets*/
static const lv_font_fmt_txt_cmap_t cmaps[] = {
{
.range_start = 32, .range_length = 96, .glyph_id_start = 1,
.unicode_list = NULL, .glyph_id_ofs_list = NULL, .list_length = 0, .type = LV_FONT_FMT_TXT_CMAP_FORMAT0_TINY
}
};
/*--------------------
* ALL CUSTOM DATA
*--------------------*/
#if LVGL_VERSION_MAJOR >= 8
/*Store all the custom data of the font*/
static const lv_font_fmt_txt_dsc_t font_dsc = {
#else
static lv_font_fmt_txt_dsc_t font_dsc = {
#endif
.glyph_bitmap = glyph_bitmap,
.glyph_dsc = glyph_dsc,
.cmaps = cmaps,
.kern_dsc = NULL,
.kern_scale = 0,
.cmap_num = 1,
.bpp = 1,
.kern_classes = 0,
.bitmap_format = 0,
};
/*-----------------
* PUBLIC FONT
*----------------*/
/*Initialize a public general font descriptor*/
#if LVGL_VERSION_MAJOR >= 8
const lv_font_t lv_font_unscii_8 = {
#else
lv_font_t lv_font_unscii_8 = {
#endif
.get_glyph_dsc = lv_font_get_glyph_dsc_fmt_txt, /*Function pointer to get glyph's data*/
.get_glyph_bitmap = lv_font_get_bitmap_fmt_txt, /*Function pointer to get glyph's bitmap*/
.line_height = 9, /*The maximum line height required by the font*/
.base_line = 0, /*Baseline measured from the bottom of the line*/
#if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0)
.subpx = LV_FONT_SUBPX_NONE,
#endif
#if LV_VERSION_CHECK(7, 4, 0) || LVGL_VERSION_MAJOR >= 8
.underline_position = 0,
.underline_thickness = 0,
#endif
.dsc = &font_dsc /*The custom font data. Will be accessed by `get_glyph_bitmap/dsc` */
};
#endif /*#if LV_FONT_UNSCII_8*/
+357
View File
@@ -0,0 +1,357 @@
/**
* @file lv_symbol_def.h
*
*/
#ifndef LV_SYMBOL_DEF_H
#define LV_SYMBOL_DEF_H
#ifdef __cplusplus
extern "C" {
#endif
#include "../lv_conf_internal.h"
/*-------------------------------
* Symbols from "normal" font
*-----------------------------*/
#if !defined LV_SYMBOL_BULLET
#define LV_SYMBOL_BULLET "\xE2\x80\xA2" /*20042, 0x2022*/
#endif
/*-------------------------------
* Symbols from FontAwesome font
*-----------------------------*/
/*In the font converter use this list as range:
61441, 61448, 61451, 61452, 61453, 61457, 61459, 61461, 61465, 61468,
61473, 61478, 61479, 61480, 61502, 61507, 61512, 61515, 61516, 61517,
61521, 61522, 61523, 61524, 61543, 61544, 61550, 61552, 61553, 61556,
61559, 61560, 61561, 61563, 61587, 61589, 61636, 61637, 61639, 61641,
61664, 61671, 61674, 61683, 61724, 61732, 61787, 61931, 62016, 62017,
62018, 62019, 62020, 62087, 62099, 62189, 62212, 62810, 63426, 63650
*/
/* These symbols can be predefined in the lv_conf.h file.
* If they are not predefined, they will use the following values
*/
#if !defined LV_SYMBOL_AUDIO
#define LV_SYMBOL_AUDIO "\xEF\x80\x81" /*61441, 0xF001*/
#endif
#if !defined LV_SYMBOL_VIDEO
#define LV_SYMBOL_VIDEO "\xEF\x80\x88" /*61448, 0xF008*/
#endif
#if !defined LV_SYMBOL_LIST
#define LV_SYMBOL_LIST "\xEF\x80\x8B" /*61451, 0xF00B*/
#endif
#if !defined LV_SYMBOL_OK
#define LV_SYMBOL_OK "\xEF\x80\x8C" /*61452, 0xF00C*/
#endif
#if !defined LV_SYMBOL_CLOSE
#define LV_SYMBOL_CLOSE "\xEF\x80\x8D" /*61453, 0xF00D*/
#endif
#if !defined LV_SYMBOL_POWER
#define LV_SYMBOL_POWER "\xEF\x80\x91" /*61457, 0xF011*/
#endif
#if !defined LV_SYMBOL_SETTINGS
#define LV_SYMBOL_SETTINGS "\xEF\x80\x93" /*61459, 0xF013*/
#endif
#if !defined LV_SYMBOL_HOME
#define LV_SYMBOL_HOME "\xEF\x80\x95" /*61461, 0xF015*/
#endif
#if !defined LV_SYMBOL_DOWNLOAD
#define LV_SYMBOL_DOWNLOAD "\xEF\x80\x99" /*61465, 0xF019*/
#endif
#if !defined LV_SYMBOL_DRIVE
#define LV_SYMBOL_DRIVE "\xEF\x80\x9C" /*61468, 0xF01C*/
#endif
#if !defined LV_SYMBOL_REFRESH
#define LV_SYMBOL_REFRESH "\xEF\x80\xA1" /*61473, 0xF021*/
#endif
#if !defined LV_SYMBOL_MUTE
#define LV_SYMBOL_MUTE "\xEF\x80\xA6" /*61478, 0xF026*/
#endif
#if !defined LV_SYMBOL_VOLUME_MID
#define LV_SYMBOL_VOLUME_MID "\xEF\x80\xA7" /*61479, 0xF027*/
#endif
#if !defined LV_SYMBOL_VOLUME_MAX
#define LV_SYMBOL_VOLUME_MAX "\xEF\x80\xA8" /*61480, 0xF028*/
#endif
#if !defined LV_SYMBOL_IMAGE
#define LV_SYMBOL_IMAGE "\xEF\x80\xBE" /*61502, 0xF03E*/
#endif
#if !defined LV_SYMBOL_TINT
#define LV_SYMBOL_TINT "\xEF\x81\x83" /*61507, 0xF043*/
#endif
#if !defined LV_SYMBOL_PREV
#define LV_SYMBOL_PREV "\xEF\x81\x88" /*61512, 0xF048*/
#endif
#if !defined LV_SYMBOL_PLAY
#define LV_SYMBOL_PLAY "\xEF\x81\x8B" /*61515, 0xF04B*/
#endif
#if !defined LV_SYMBOL_PAUSE
#define LV_SYMBOL_PAUSE "\xEF\x81\x8C" /*61516, 0xF04C*/
#endif
#if !defined LV_SYMBOL_STOP
#define LV_SYMBOL_STOP "\xEF\x81\x8D" /*61517, 0xF04D*/
#endif
#if !defined LV_SYMBOL_NEXT
#define LV_SYMBOL_NEXT "\xEF\x81\x91" /*61521, 0xF051*/
#endif
#if !defined LV_SYMBOL_EJECT
#define LV_SYMBOL_EJECT "\xEF\x81\x92" /*61522, 0xF052*/
#endif
#if !defined LV_SYMBOL_LEFT
#define LV_SYMBOL_LEFT "\xEF\x81\x93" /*61523, 0xF053*/
#endif
#if !defined LV_SYMBOL_RIGHT
#define LV_SYMBOL_RIGHT "\xEF\x81\x94" /*61524, 0xF054*/
#endif
#if !defined LV_SYMBOL_PLUS
#define LV_SYMBOL_PLUS "\xEF\x81\xA7" /*61543, 0xF067*/
#endif
#if !defined LV_SYMBOL_MINUS
#define LV_SYMBOL_MINUS "\xEF\x81\xA8" /*61544, 0xF068*/
#endif
#if !defined LV_SYMBOL_EYE_OPEN
#define LV_SYMBOL_EYE_OPEN "\xEF\x81\xAE" /*61550, 0xF06E*/
#endif
#if !defined LV_SYMBOL_EYE_CLOSE
#define LV_SYMBOL_EYE_CLOSE "\xEF\x81\xB0" /*61552, 0xF070*/
#endif
#if !defined LV_SYMBOL_WARNING
#define LV_SYMBOL_WARNING "\xEF\x81\xB1" /*61553, 0xF071*/
#endif
#if !defined LV_SYMBOL_SHUFFLE
#define LV_SYMBOL_SHUFFLE "\xEF\x81\xB4" /*61556, 0xF074*/
#endif
#if !defined LV_SYMBOL_UP
#define LV_SYMBOL_UP "\xEF\x81\xB7" /*61559, 0xF077*/
#endif
#if !defined LV_SYMBOL_DOWN
#define LV_SYMBOL_DOWN "\xEF\x81\xB8" /*61560, 0xF078*/
#endif
#if !defined LV_SYMBOL_LOOP
#define LV_SYMBOL_LOOP "\xEF\x81\xB9" /*61561, 0xF079*/
#endif
#if !defined LV_SYMBOL_DIRECTORY
#define LV_SYMBOL_DIRECTORY "\xEF\x81\xBB" /*61563, 0xF07B*/
#endif
#if !defined LV_SYMBOL_UPLOAD
#define LV_SYMBOL_UPLOAD "\xEF\x82\x93" /*61587, 0xF093*/
#endif
#if !defined LV_SYMBOL_CALL
#define LV_SYMBOL_CALL "\xEF\x82\x95" /*61589, 0xF095*/
#endif
#if !defined LV_SYMBOL_CUT
#define LV_SYMBOL_CUT "\xEF\x83\x84" /*61636, 0xF0C4*/
#endif
#if !defined LV_SYMBOL_COPY
#define LV_SYMBOL_COPY "\xEF\x83\x85" /*61637, 0xF0C5*/
#endif
#if !defined LV_SYMBOL_SAVE
#define LV_SYMBOL_SAVE "\xEF\x83\x87" /*61639, 0xF0C7*/
#endif
#if !defined LV_SYMBOL_BARS
#define LV_SYMBOL_BARS "\xEF\x83\x89" /*61641, 0xF0C9*/
#endif
#if !defined LV_SYMBOL_ENVELOPE
#define LV_SYMBOL_ENVELOPE "\xEF\x83\xA0" /*61664, 0xF0E0*/
#endif
#if !defined LV_SYMBOL_CHARGE
#define LV_SYMBOL_CHARGE "\xEF\x83\xA7" /*61671, 0xF0E7*/
#endif
#if !defined LV_SYMBOL_PASTE
#define LV_SYMBOL_PASTE "\xEF\x83\xAA" /*61674, 0xF0EA*/
#endif
#if !defined LV_SYMBOL_BELL
#define LV_SYMBOL_BELL "\xEF\x83\xB3" /*61683, 0xF0F3*/
#endif
#if !defined LV_SYMBOL_KEYBOARD
#define LV_SYMBOL_KEYBOARD "\xEF\x84\x9C" /*61724, 0xF11C*/
#endif
#if !defined LV_SYMBOL_GPS
#define LV_SYMBOL_GPS "\xEF\x84\xA4" /*61732, 0xF124*/
#endif
#if !defined LV_SYMBOL_FILE
#define LV_SYMBOL_FILE "\xEF\x85\x9B" /*61787, 0xF158*/
#endif
#if !defined LV_SYMBOL_WIFI
#define LV_SYMBOL_WIFI "\xEF\x87\xAB" /*61931, 0xF1EB*/
#endif
#if !defined LV_SYMBOL_BATTERY_FULL
#define LV_SYMBOL_BATTERY_FULL "\xEF\x89\x80" /*62016, 0xF240*/
#endif
#if !defined LV_SYMBOL_BATTERY_3
#define LV_SYMBOL_BATTERY_3 "\xEF\x89\x81" /*62017, 0xF241*/
#endif
#if !defined LV_SYMBOL_BATTERY_2
#define LV_SYMBOL_BATTERY_2 "\xEF\x89\x82" /*62018, 0xF242*/
#endif
#if !defined LV_SYMBOL_BATTERY_1
#define LV_SYMBOL_BATTERY_1 "\xEF\x89\x83" /*62019, 0xF243*/
#endif
#if !defined LV_SYMBOL_BATTERY_EMPTY
#define LV_SYMBOL_BATTERY_EMPTY "\xEF\x89\x84" /*62020, 0xF244*/
#endif
#if !defined LV_SYMBOL_USB
#define LV_SYMBOL_USB "\xEF\x8a\x87" /*62087, 0xF287*/
#endif
#if !defined LV_SYMBOL_BLUETOOTH
#define LV_SYMBOL_BLUETOOTH "\xEF\x8a\x93" /*62099, 0xF293*/
#endif
#if !defined LV_SYMBOL_TRASH
#define LV_SYMBOL_TRASH "\xEF\x8B\xAD" /*62189, 0xF2ED*/
#endif
#if !defined LV_SYMBOL_EDIT
#define LV_SYMBOL_EDIT "\xEF\x8C\x84" /*62212, 0xF304*/
#endif
#if !defined LV_SYMBOL_BACKSPACE
#define LV_SYMBOL_BACKSPACE "\xEF\x95\x9A" /*62810, 0xF55A*/
#endif
#if !defined LV_SYMBOL_SD_CARD
#define LV_SYMBOL_SD_CARD "\xEF\x9F\x82" /*63426, 0xF7C2*/
#endif
#if !defined LV_SYMBOL_NEW_LINE
#define LV_SYMBOL_NEW_LINE "\xEF\xA2\xA2" /*63650, 0xF8A2*/
#endif
#if !defined LV_SYMBOL_DUMMY
/** Invalid symbol at (U+F8FF). If written before a string then `lv_img` will show it as a label*/
#define LV_SYMBOL_DUMMY "\xEF\xA3\xBF"
#endif
/*
* The following list is generated using
* cat src/font/lv_symbol_def.h | sed -E -n 's/^#define\s+LV_(SYMBOL_\w+).*".*$/ LV_STR_\1,/p'
*/
enum {
LV_STR_SYMBOL_BULLET,
LV_STR_SYMBOL_AUDIO,
LV_STR_SYMBOL_VIDEO,
LV_STR_SYMBOL_LIST,
LV_STR_SYMBOL_OK,
LV_STR_SYMBOL_CLOSE,
LV_STR_SYMBOL_POWER,
LV_STR_SYMBOL_SETTINGS,
LV_STR_SYMBOL_HOME,
LV_STR_SYMBOL_DOWNLOAD,
LV_STR_SYMBOL_DRIVE,
LV_STR_SYMBOL_REFRESH,
LV_STR_SYMBOL_MUTE,
LV_STR_SYMBOL_VOLUME_MID,
LV_STR_SYMBOL_VOLUME_MAX,
LV_STR_SYMBOL_IMAGE,
LV_STR_SYMBOL_TINT,
LV_STR_SYMBOL_PREV,
LV_STR_SYMBOL_PLAY,
LV_STR_SYMBOL_PAUSE,
LV_STR_SYMBOL_STOP,
LV_STR_SYMBOL_NEXT,
LV_STR_SYMBOL_EJECT,
LV_STR_SYMBOL_LEFT,
LV_STR_SYMBOL_RIGHT,
LV_STR_SYMBOL_PLUS,
LV_STR_SYMBOL_MINUS,
LV_STR_SYMBOL_EYE_OPEN,
LV_STR_SYMBOL_EYE_CLOSE,
LV_STR_SYMBOL_WARNING,
LV_STR_SYMBOL_SHUFFLE,
LV_STR_SYMBOL_UP,
LV_STR_SYMBOL_DOWN,
LV_STR_SYMBOL_LOOP,
LV_STR_SYMBOL_DIRECTORY,
LV_STR_SYMBOL_UPLOAD,
LV_STR_SYMBOL_CALL,
LV_STR_SYMBOL_CUT,
LV_STR_SYMBOL_COPY,
LV_STR_SYMBOL_SAVE,
LV_STR_SYMBOL_BARS,
LV_STR_SYMBOL_ENVELOPE,
LV_STR_SYMBOL_CHARGE,
LV_STR_SYMBOL_PASTE,
LV_STR_SYMBOL_BELL,
LV_STR_SYMBOL_KEYBOARD,
LV_STR_SYMBOL_GPS,
LV_STR_SYMBOL_FILE,
LV_STR_SYMBOL_WIFI,
LV_STR_SYMBOL_BATTERY_FULL,
LV_STR_SYMBOL_BATTERY_3,
LV_STR_SYMBOL_BATTERY_2,
LV_STR_SYMBOL_BATTERY_1,
LV_STR_SYMBOL_BATTERY_EMPTY,
LV_STR_SYMBOL_USB,
LV_STR_SYMBOL_BLUETOOTH,
LV_STR_SYMBOL_TRASH,
LV_STR_SYMBOL_EDIT,
LV_STR_SYMBOL_BACKSPACE,
LV_STR_SYMBOL_SD_CARD,
LV_STR_SYMBOL_NEW_LINE,
LV_STR_SYMBOL_DUMMY,
};
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_SYMBOL_DEF_H*/