Description
How to convert a font.c file to arduino .h file
What MCU/Processor/Board and compiler are you using?
Teensy 4.1
What LVGL version are you using?
8.3
What do you want to achieve?
I would like to convert the font.c file into a .h file so that I can access the font data within my code.
I have successfully done this for .c images and will have no problem converting the:
static LV_ATTRIBUTE_LARGE_CONST const uint8_t glyph_bitmap[] = {
The tricky bits for me are:
/*---------------------
* 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 = 50, .box_w = 1, .box_h = 1, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 1, .adv_w = 50, .box_w = 3, .box_h = 6, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 4, .adv_w = 90, .box_w = 5, .box_h = 3, .ofs_x = 0, .ofs_y = 3},
{.bitmap_index = 6, .adv_w = 150, .box_w = 9, .box_h = 6, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 13, .adv_w = 100, .box_w = 5, .box_h = 7, .ofs_x = 1, .ofs_y = -1},
{.bitmap_index = 18, .adv_w = 130, .box_w = 8, .box_h = 6, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 24, .adv_w = 90, .box_w = 4, .box_h = 4, .ofs_x = 1, .ofs_y = 1},
{.bitmap_index = 26, .adv_w = 50, .box_w = 3, .box_h = 3, .ofs_x = 0, .ofs_y = 3},
{.bitmap_index = 28, .adv_w = 80, .box_w = 5, .box_h = 6, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 32, .adv_w = 80, .box_w = 5, .box_h = 6, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 36, .adv_w = 110, .box_w = 7, .box_h = 6, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 42, .adv_w = 110, .box_w = 6, .box_h = 6, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 47, .adv_w = 40, .box_w = 2, .box_h = 3, .ofs_x = 0, .ofs_y = -1},
{.bitmap_index = 48, .adv_w = 90, .box_w = 5, .box_h = 1, .ofs_x = 0, .ofs_y = 3},
{.bitmap_index = 49, .adv_w = 40, .box_w = 2, .box_h = 2, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 50, .adv_w = 130, .box_w = 8, .box_h = 6, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 56, .adv_w = 110, .box_w = 6, .box_h = 6, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 61, .adv_w = 50, .box_w = 3, .box_h = 6, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 64, .adv_w = 110, .box_w = 6, .box_h = 6, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 69, .adv_w = 110, .box_w = 7, .box_h = 6, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 75, .adv_w = 110, .box_w = 6, .box_h = 6, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 80, .adv_w = 110, .box_w = 6, .box_h = 6, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 85, .adv_w = 110, .box_w = 6, .box_h = 6, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 90, .adv_w = 110, .box_w = 7, .box_h = 6, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 96, .adv_w = 110, .box_w = 6, .box_h = 6, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 101, .adv_w = 110, .box_w = 6, .box_h = 6, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 106, .adv_w = 40, .box_w = 2, .box_h = 5, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 108, .adv_w = 40, .box_w = 3, .box_h = 6, .ofs_x = -1, .ofs_y = -1},
{.bitmap_index = 111, .adv_w = 80, .box_w = 4, .box_h = 6, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 114, .adv_w = 90, .box_w = 5, .box_h = 3, .ofs_x = 0, .ofs_y = 2},
{.bitmap_index = 116, .adv_w = 100, .box_w = 4, .box_h = 6, .ofs_x = 2, .ofs_y = 0},
{.bitmap_index = 119, .adv_w = 100, .box_w = 5, .box_h = 6, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 123, .adv_w = 100, .box_w = 6, .box_h = 5, .ofs_x = 0, .ofs_y = 1},
{.bitmap_index = 127, .adv_w = 110, .box_w = 6, .box_h = 6, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 132, .adv_w = 110, .box_w = 6, .box_h = 6, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 137, .adv_w = 110, .box_w = 7, .box_h = 6, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 143, .adv_w = 110, .box_w = 6, .box_h = 6, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 148, .adv_w = 110, .box_w = 7, .box_h = 6, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 154, .adv_w = 110, .box_w = 7, .box_h = 6, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 160, .adv_w = 110, .box_w = 6, .box_h = 6, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 165, .adv_w = 110, .box_w = 6, .box_h = 6, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 170, .adv_w = 100, .box_w = 5, .box_h = 6, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 174, .adv_w = 110, .box_w = 6, .box_h = 6, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 179, .adv_w = 110, .box_w = 6, .box_h = 6, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 184, .adv_w = 110, .box_w = 7, .box_h = 6, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 190, .adv_w = 150, .box_w = 9, .box_h = 6, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 197, .adv_w = 110, .box_w = 6, .box_h = 6, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 202, .adv_w = 110, .box_w = 6, .box_h = 6, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 207, .adv_w = 110, .box_w = 6, .box_h = 6, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 212, .adv_w = 110, .box_w = 6, .box_h = 6, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 217, .adv_w = 110, .box_w = 6, .box_h = 6, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 222, .adv_w = 110, .box_w = 6, .box_h = 6, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 227, .adv_w = 110, .box_w = 6, .box_h = 6, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 232, .adv_w = 110, .box_w = 6, .box_h = 6, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 237, .adv_w = 110, .box_w = 6, .box_h = 6, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 242, .adv_w = 150, .box_w = 9, .box_h = 6, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 249, .adv_w = 110, .box_w = 6, .box_h = 6, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 254, .adv_w = 110, .box_w = 6, .box_h = 6, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 259, .adv_w = 110, .box_w = 7, .box_h = 6, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 265, .adv_w = 70, .box_w = 4, .box_h = 6, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 268, .adv_w = 130, .box_w = 8, .box_h = 7, .ofs_x = 0, .ofs_y = -1},
{.bitmap_index = 275, .adv_w = 70, .box_w = 4, .box_h = 6, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 278, .adv_w = 100, .box_w = 5, .box_h = 3, .ofs_x = 1, .ofs_y = 4},
{.bitmap_index = 280, .adv_w = 110, .box_w = 6, .box_h = 1, .ofs_x = 0, .ofs_y = -2},
{.bitmap_index = 281, .adv_w = 130, .box_w = 8, .box_h = 8, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 289, .adv_w = 110, .box_w = 7, .box_h = 5, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 294, .adv_w = 110, .box_w = 6, .box_h = 6, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 299, .adv_w = 110, .box_w = 7, .box_h = 5, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 304, .adv_w = 110, .box_w = 6, .box_h = 6, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 309, .adv_w = 110, .box_w = 7, .box_h = 5, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 314, .adv_w = 80, .box_w = 5, .box_h = 6, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 318, .adv_w = 110, .box_w = 6, .box_h = 6, .ofs_x = 0, .ofs_y = -1},
{.bitmap_index = 323, .adv_w = 110, .box_w = 6, .box_h = 6, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 328, .adv_w = 60, .box_w = 3, .box_h = 6, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 331, .adv_w = 70, .box_w = 4, .box_h = 7, .ofs_x = 0, .ofs_y = -1},
{.bitmap_index = 335, .adv_w = 110, .box_w = 6, .box_h = 6, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 340, .adv_w = 50, .box_w = 3, .box_h = 6, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 343, .adv_w = 150, .box_w = 9, .box_h = 5, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 349, .adv_w = 110, .box_w = 6, .box_h = 5, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 353, .adv_w = 110, .box_w = 6, .box_h = 5, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 357, .adv_w = 110, .box_w = 6, .box_h = 6, .ofs_x = 0, .ofs_y = -1},
{.bitmap_index = 362, .adv_w = 110, .box_w = 6, .box_h = 6, .ofs_x = 0, .ofs_y = -1},
{.bitmap_index = 367, .adv_w = 110, .box_w = 7, .box_h = 5, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 372, .adv_w = 110, .box_w = 7, .box_h = 5, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 377, .adv_w = 80, .box_w = 5, .box_h = 6, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 381, .adv_w = 110, .box_w = 6, .box_h = 5, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 385, .adv_w = 110, .box_w = 6, .box_h = 5, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 389, .adv_w = 150, .box_w = 9, .box_h = 5, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 395, .adv_w = 110, .box_w = 6, .box_h = 5, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 399, .adv_w = 110, .box_w = 6, .box_h = 6, .ofs_x = 0, .ofs_y = -1},
{.bitmap_index = 404, .adv_w = 110, .box_w = 6, .box_h = 5, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 408, .adv_w = 110, .box_w = 6, .box_h = 4, .ofs_x = 0, .ofs_y = 1},
{.bitmap_index = 411, .adv_w = 30, .box_w = 1, .box_h = 9, .ofs_x = 0, .ofs_y = -1},
{.bitmap_index = 413, .adv_w = 110, .box_w = 6, .box_h = 4, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 416, .adv_w = 110, .box_w = 7, .box_h = 3, .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 = 95, .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 LV_VERSION_CHECK(8, 0, 0)
/*Store all the custom data of the font*/
static lv_font_fmt_txt_glyph_cache_t cache;
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,
#if LV_VERSION_CHECK(8, 0, 0)
.cache = &cache
#endif
};
/*-----------------
* PUBLIC FONT
*----------------*/
/*Initialize a public general font descriptor*/
#if LV_VERSION_CHECK(8, 0, 0)
const lv_font_t ui_font_t10 = {
#else
lv_font_t ui_font_t10 = {
#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 = 10, /*The maximum line height required by the font*/
.base_line = 2, /*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 = -1,
.underline_thickness = 0,
#endif
.dsc = &font_dsc /*The custom font data. Will be accessed by `get_glyph_bitmap/dsc` */
};
#endif /*#if UI_FONT_T10*/
Here is the full font code:
#include "ui.h"
#ifndef UI_FONT_T10
#define UI_FONT_T10 1
#endif
#if UI_FONT_T10
/*-----------------
* BITMAPS
*----------------*/
/*Store the image of the glyphs*/
static LV_ATTRIBUTE_LARGE_CONST const uint8_t glyph_bitmap[] = {
/* U+0020 " " */
0x0,
/* U+0021 "!" */
0xff, 0xf1, 0xc0,
/* U+0022 "\"" */
0xde, 0xd4,
/* U+0023 "#" */
0x77, 0x7f, 0xdd, 0xce, 0xef, 0xfb, 0xb8,
/* U+0024 "$" */
0x27, 0xe9, 0xf2, 0xfc, 0x80,
/* U+0025 "%" */
0xef, 0xee, 0x3c, 0x77, 0x77, 0xe7,
/* U+0026 "&" */
0x44, 0xf4,
/* U+0027 "'" */
0xfd, 0x0,
/* U+0028 "(" */
0x3b, 0xb8, 0xe7, 0xc,
/* U+0029 ")" */
0xe3, 0x8e, 0xe7, 0x60,
/* U+002A "*" */
0xc6, 0xd8, 0xe1, 0xc6, 0xd8, 0xc0,
/* U+002B "+" */
0x10, 0x4f, 0xc4, 0x10, 0x40,
/* U+002C "," */
0xf8,
/* U+002D "-" */
0xf8,
/* U+002E "." */
0xf0,
/* U+002F "/" */
0x2, 0x7, 0x4c, 0xfc, 0x30, 0x20,
/* U+0030 "0" */
0xff, 0xff, 0xff, 0xff, 0xf0,
/* U+0031 "1" */
0xff, 0xff, 0xc0,
/* U+0032 "2" */
0xfc, 0x7f, 0xf8, 0xe3, 0xf0,
/* U+0033 "3" */
0xfe, 0x1f, 0xf8, 0x70, 0xff, 0xc0,
/* U+0034 "4" */
0xff, 0xff, 0xc7, 0x1c, 0x70,
/* U+0035 "5" */
0xff, 0x8f, 0xc7, 0x1f, 0xf0,
/* U+0036 "6" */
0xff, 0x8f, 0xff, 0xff, 0xf0,
/* U+0037 "7" */
0xfe, 0x1c, 0x38, 0x70, 0xe1, 0xc0,
/* U+0038 "8" */
0xff, 0xff, 0xff, 0xff, 0xf0,
/* U+0039 "9" */
0xff, 0xff, 0xc7, 0x1f, 0xf0,
/* U+003A ":" */
0xf3, 0xc0,
/* U+003B ";" */
0x6c, 0x37, 0x80,
/* U+003C "<" */
0x37, 0xf7, 0x71,
/* U+003D "=" */
0xf8, 0x3e,
/* U+003E ">" */
0xce, 0xfe, 0xe8,
/* U+003F "?" */
0xf6, 0xce, 0xe0, 0x30,
/* U+0040 "@" */
0x1f, 0xfb, 0x22, 0xf8,
/* U+0041 "A" */
0x7b, 0xff, 0xff, 0xff, 0xf0,
/* U+0042 "B" */
0xff, 0xff, 0xff, 0xff, 0xf0,
/* U+0043 "C" */
0xff, 0xc3, 0x87, 0xe, 0xf, 0xc0,
/* U+0044 "D" */
0xff, 0xff, 0xff, 0xff, 0xe0,
/* U+0045 "E" */
0xff, 0xc3, 0xf7, 0xe, 0x1f, 0xc0,
/* U+0046 "F" */
0xff, 0xc3, 0xf7, 0xe, 0x1c, 0x0,
/* U+0047 "G" */
0xff, 0x8f, 0xff, 0xfd, 0xf0,
/* U+0048 "H" */
0xff, 0xff, 0xff, 0xff, 0xf0,
/* U+0049 "I" */
0xfb, 0x9c, 0xe7, 0x7c,
/* U+004A "J" */
0x1c, 0x71, 0xff, 0xfd, 0xf0,
/* U+004B "K" */
0xff, 0xff, 0xbe, 0xff, 0xf0,
/* U+004C "L" */
0xe1, 0xc3, 0x87, 0xe, 0x1f, 0xc0,
/* U+004D "M" */
0xe3, 0xfb, 0xff, 0xfd, 0x7e, 0x3f, 0x1c,
/* U+004E "N" */
0xff, 0xff, 0xff, 0xff, 0xf0,
/* U+004F "O" */
0xff, 0xff, 0xff, 0xfd, 0xe0,
/* U+0050 "P" */
0xfb, 0xff, 0xf8, 0xe3, 0x80,
/* U+0051 "Q" */
0xff, 0xff, 0xff, 0xf9, 0xf0,
/* U+0052 "R" */
0xff, 0xff, 0xbe, 0xff, 0xf0,
/* U+0053 "S" */
0x7f, 0x8f, 0x87, 0x1f, 0xe0,
/* U+0054 "T" */
0xfc, 0xe3, 0x8e, 0x38, 0xe0,
/* U+0055 "U" */
0xff, 0xff, 0xff, 0xfd, 0xe0,
/* U+0056 "V" */
0xff, 0xff, 0xff, 0xfb, 0xc0,
/* U+0057 "W" */
0xe3, 0xf1, 0xff, 0xff, 0xff, 0x7f, 0x1c,
/* U+0058 "X" */
0xff, 0xf7, 0xdf, 0xff, 0xf0,
/* U+0059 "Y" */
0xff, 0xf7, 0xce, 0x38, 0xe0,
/* U+005A "Z" */
0xfe, 0x3c, 0xe3, 0xce, 0x1f, 0xc0,
/* U+005B "[" */
0xfe, 0xee, 0xef,
/* U+005C "\\" */
0x38, 0x38, 0xff, 0xff, 0x38, 0x38, 0x38,
/* U+005D "]" */
0xf7, 0x77, 0x7f,
/* U+005E "^" */
0x67, 0xbe,
/* U+005F "_" */
0xfc,
/* U+0060 "`" */
0x1f, 0xf, 0xef, 0x9b, 0xb1, 0x84, 0x84, 0xfc,
/* U+0061 "a" */
0xfe, 0x1f, 0xff, 0x77, 0xe0,
/* U+0062 "b" */
0xe3, 0xef, 0xff, 0xff, 0xf0,
/* U+0063 "c" */
0x7f, 0xc3, 0x87, 0xf, 0xe0,
/* U+0064 "d" */
0x1d, 0xff, 0xff, 0xff, 0xf0,
/* U+0065 "e" */
0x7d, 0xdf, 0xff, 0xf, 0xe0,
/* U+0066 "f" */
0x7f, 0x3f, 0xce, 0x70,
/* U+0067 "g" */
0x7b, 0xff, 0xff, 0xfd, 0xf0,
/* U+0068 "h" */
0xe3, 0xef, 0xff, 0xff, 0xf0,
/* U+0069 "i" */
0xe3, 0xff, 0xc0,
/* U+006A "j" */
0x77, 0x77, 0x77, 0xe0,
/* U+006B "k" */
0xe3, 0xff, 0xbe, 0xff, 0xf0,
/* U+006C "l" */
0xff, 0xff, 0xc0,
/* U+006D "m" */
0xff, 0x7f, 0xff, 0xff, 0xff, 0xf8,
/* U+006E "n" */
0xfb, 0xff, 0xff, 0xfc,
/* U+006F "o" */
0x7b, 0xff, 0xff, 0xfc,
/* U+0070 "p" */
0xff, 0xff, 0xff, 0xfb, 0x80,
/* U+0071 "q" */
0xff, 0xff, 0xff, 0x7c, 0x70,
/* U+0072 "r" */
0x7f, 0xc3, 0x87, 0xe, 0x0,
/* U+0073 "s" */
0x7f, 0xc1, 0xf8, 0x7f, 0xc0,
/* U+0074 "t" */
0xe7, 0xf9, 0xce, 0x3c,
/* U+0075 "u" */
0xff, 0xff, 0xff, 0x7c,
/* U+0076 "v" */
0xff, 0xff, 0xfe, 0xf8,
/* U+0077 "w" */
0xff, 0xff, 0xff, 0xff, 0xf7, 0xf0,
/* U+0078 "x" */
0xfd, 0xf3, 0xdf, 0xfc,
/* U+0079 "y" */
0xff, 0xff, 0xff, 0x7d, 0xf0,
/* U+007A "z" */
0xfc, 0xe3, 0x9c, 0xfc,
/* U+007B "{" */
0x30, 0xc7, 0xbf,
/* U+007C "|" */
0xff, 0x80,
/* U+007D "}" */
0xfd, 0xe3, 0xc,
/* U+007E "~" */
0x6d, 0x7d, 0xb0
};
/*---------------------
* 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 = 50, .box_w = 1, .box_h = 1, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 1, .adv_w = 50, .box_w = 3, .box_h = 6, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 4, .adv_w = 90, .box_w = 5, .box_h = 3, .ofs_x = 0, .ofs_y = 3},
{.bitmap_index = 6, .adv_w = 150, .box_w = 9, .box_h = 6, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 13, .adv_w = 100, .box_w = 5, .box_h = 7, .ofs_x = 1, .ofs_y = -1},
{.bitmap_index = 18, .adv_w = 130, .box_w = 8, .box_h = 6, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 24, .adv_w = 90, .box_w = 4, .box_h = 4, .ofs_x = 1, .ofs_y = 1},
{.bitmap_index = 26, .adv_w = 50, .box_w = 3, .box_h = 3, .ofs_x = 0, .ofs_y = 3},
{.bitmap_index = 28, .adv_w = 80, .box_w = 5, .box_h = 6, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 32, .adv_w = 80, .box_w = 5, .box_h = 6, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 36, .adv_w = 110, .box_w = 7, .box_h = 6, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 42, .adv_w = 110, .box_w = 6, .box_h = 6, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 47, .adv_w = 40, .box_w = 2, .box_h = 3, .ofs_x = 0, .ofs_y = -1},
{.bitmap_index = 48, .adv_w = 90, .box_w = 5, .box_h = 1, .ofs_x = 0, .ofs_y = 3},
{.bitmap_index = 49, .adv_w = 40, .box_w = 2, .box_h = 2, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 50, .adv_w = 130, .box_w = 8, .box_h = 6, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 56, .adv_w = 110, .box_w = 6, .box_h = 6, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 61, .adv_w = 50, .box_w = 3, .box_h = 6, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 64, .adv_w = 110, .box_w = 6, .box_h = 6, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 69, .adv_w = 110, .box_w = 7, .box_h = 6, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 75, .adv_w = 110, .box_w = 6, .box_h = 6, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 80, .adv_w = 110, .box_w = 6, .box_h = 6, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 85, .adv_w = 110, .box_w = 6, .box_h = 6, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 90, .adv_w = 110, .box_w = 7, .box_h = 6, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 96, .adv_w = 110, .box_w = 6, .box_h = 6, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 101, .adv_w = 110, .box_w = 6, .box_h = 6, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 106, .adv_w = 40, .box_w = 2, .box_h = 5, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 108, .adv_w = 40, .box_w = 3, .box_h = 6, .ofs_x = -1, .ofs_y = -1},
{.bitmap_index = 111, .adv_w = 80, .box_w = 4, .box_h = 6, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 114, .adv_w = 90, .box_w = 5, .box_h = 3, .ofs_x = 0, .ofs_y = 2},
{.bitmap_index = 116, .adv_w = 100, .box_w = 4, .box_h = 6, .ofs_x = 2, .ofs_y = 0},
{.bitmap_index = 119, .adv_w = 100, .box_w = 5, .box_h = 6, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 123, .adv_w = 100, .box_w = 6, .box_h = 5, .ofs_x = 0, .ofs_y = 1},
{.bitmap_index = 127, .adv_w = 110, .box_w = 6, .box_h = 6, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 132, .adv_w = 110, .box_w = 6, .box_h = 6, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 137, .adv_w = 110, .box_w = 7, .box_h = 6, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 143, .adv_w = 110, .box_w = 6, .box_h = 6, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 148, .adv_w = 110, .box_w = 7, .box_h = 6, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 154, .adv_w = 110, .box_w = 7, .box_h = 6, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 160, .adv_w = 110, .box_w = 6, .box_h = 6, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 165, .adv_w = 110, .box_w = 6, .box_h = 6, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 170, .adv_w = 100, .box_w = 5, .box_h = 6, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 174, .adv_w = 110, .box_w = 6, .box_h = 6, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 179, .adv_w = 110, .box_w = 6, .box_h = 6, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 184, .adv_w = 110, .box_w = 7, .box_h = 6, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 190, .adv_w = 150, .box_w = 9, .box_h = 6, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 197, .adv_w = 110, .box_w = 6, .box_h = 6, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 202, .adv_w = 110, .box_w = 6, .box_h = 6, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 207, .adv_w = 110, .box_w = 6, .box_h = 6, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 212, .adv_w = 110, .box_w = 6, .box_h = 6, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 217, .adv_w = 110, .box_w = 6, .box_h = 6, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 222, .adv_w = 110, .box_w = 6, .box_h = 6, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 227, .adv_w = 110, .box_w = 6, .box_h = 6, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 232, .adv_w = 110, .box_w = 6, .box_h = 6, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 237, .adv_w = 110, .box_w = 6, .box_h = 6, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 242, .adv_w = 150, .box_w = 9, .box_h = 6, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 249, .adv_w = 110, .box_w = 6, .box_h = 6, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 254, .adv_w = 110, .box_w = 6, .box_h = 6, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 259, .adv_w = 110, .box_w = 7, .box_h = 6, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 265, .adv_w = 70, .box_w = 4, .box_h = 6, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 268, .adv_w = 130, .box_w = 8, .box_h = 7, .ofs_x = 0, .ofs_y = -1},
{.bitmap_index = 275, .adv_w = 70, .box_w = 4, .box_h = 6, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 278, .adv_w = 100, .box_w = 5, .box_h = 3, .ofs_x = 1, .ofs_y = 4},
{.bitmap_index = 280, .adv_w = 110, .box_w = 6, .box_h = 1, .ofs_x = 0, .ofs_y = -2},
{.bitmap_index = 281, .adv_w = 130, .box_w = 8, .box_h = 8, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 289, .adv_w = 110, .box_w = 7, .box_h = 5, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 294, .adv_w = 110, .box_w = 6, .box_h = 6, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 299, .adv_w = 110, .box_w = 7, .box_h = 5, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 304, .adv_w = 110, .box_w = 6, .box_h = 6, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 309, .adv_w = 110, .box_w = 7, .box_h = 5, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 314, .adv_w = 80, .box_w = 5, .box_h = 6, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 318, .adv_w = 110, .box_w = 6, .box_h = 6, .ofs_x = 0, .ofs_y = -1},
{.bitmap_index = 323, .adv_w = 110, .box_w = 6, .box_h = 6, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 328, .adv_w = 60, .box_w = 3, .box_h = 6, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 331, .adv_w = 70, .box_w = 4, .box_h = 7, .ofs_x = 0, .ofs_y = -1},
{.bitmap_index = 335, .adv_w = 110, .box_w = 6, .box_h = 6, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 340, .adv_w = 50, .box_w = 3, .box_h = 6, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 343, .adv_w = 150, .box_w = 9, .box_h = 5, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 349, .adv_w = 110, .box_w = 6, .box_h = 5, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 353, .adv_w = 110, .box_w = 6, .box_h = 5, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 357, .adv_w = 110, .box_w = 6, .box_h = 6, .ofs_x = 0, .ofs_y = -1},
{.bitmap_index = 362, .adv_w = 110, .box_w = 6, .box_h = 6, .ofs_x = 0, .ofs_y = -1},
{.bitmap_index = 367, .adv_w = 110, .box_w = 7, .box_h = 5, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 372, .adv_w = 110, .box_w = 7, .box_h = 5, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 377, .adv_w = 80, .box_w = 5, .box_h = 6, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 381, .adv_w = 110, .box_w = 6, .box_h = 5, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 385, .adv_w = 110, .box_w = 6, .box_h = 5, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 389, .adv_w = 150, .box_w = 9, .box_h = 5, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 395, .adv_w = 110, .box_w = 6, .box_h = 5, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 399, .adv_w = 110, .box_w = 6, .box_h = 6, .ofs_x = 0, .ofs_y = -1},
{.bitmap_index = 404, .adv_w = 110, .box_w = 6, .box_h = 5, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 408, .adv_w = 110, .box_w = 6, .box_h = 4, .ofs_x = 0, .ofs_y = 1},
{.bitmap_index = 411, .adv_w = 30, .box_w = 1, .box_h = 9, .ofs_x = 0, .ofs_y = -1},
{.bitmap_index = 413, .adv_w = 110, .box_w = 6, .box_h = 4, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 416, .adv_w = 110, .box_w = 7, .box_h = 3, .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 = 95, .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 LV_VERSION_CHECK(8, 0, 0)
/*Store all the custom data of the font*/
static lv_font_fmt_txt_glyph_cache_t cache;
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,
#if LV_VERSION_CHECK(8, 0, 0)
.cache = &cache
#endif
};
/*-----------------
* PUBLIC FONT
*----------------*/
/*Initialize a public general font descriptor*/
#if LV_VERSION_CHECK(8, 0, 0)
const lv_font_t ui_font_t10 = {
#else
lv_font_t ui_font_t10 = {
#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 = 10, /*The maximum line height required by the font*/
.base_line = 2, /*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 = -1,
.underline_thickness = 0,
#endif
.dsc = &font_dsc /*The custom font data. Will be accessed by `get_glyph_bitmap/dsc` */
};
#endif /*#if UI_FONT_T10*/
NB - The font code above is produced by squarline.
Any pointers will be much appreciated.