From 1f6e32fae73463ed5ec110a304998d90f6dc3ac4 Mon Sep 17 00:00:00 2001 From: davidpkj Date: Sun, 22 Jan 2023 17:48:03 +0100 Subject: Change: colors & menu items --- src/displayapp/fonts/jetbrains_mono_42.c | 272 +++++++++++++++++++++++++++++++ 1 file changed, 272 insertions(+) create mode 100644 src/displayapp/fonts/jetbrains_mono_42.c (limited to 'src/displayapp/fonts/jetbrains_mono_42.c') diff --git a/src/displayapp/fonts/jetbrains_mono_42.c b/src/displayapp/fonts/jetbrains_mono_42.c new file mode 100644 index 00000000..caa5732d --- /dev/null +++ b/src/displayapp/fonts/jetbrains_mono_42.c @@ -0,0 +1,272 @@ +/******************************************************************************* + * Size: 42 px + * Bpp: 1 + * Opts: --size 42 --output jetbrains_mono_42.c --bpp 1 --format lvgl --no-compress --font JetBrainsMono-Regular.ttf --range 0x25, 0x2b, 0x2d, 0x30-0x3a + ******************************************************************************/ + +#ifdef LV_LVGL_H_INCLUDE_SIMPLE +#include "lvgl.h" +#else +#include "lvgl/lvgl.h" +#endif + +#ifndef JETBRAINS_MONO_42 +#define JETBRAINS_MONO_42 1 +#endif + +#if JETBRAINS_MONO_42 + +/*----------------- + * BITMAPS + *----------------*/ + +/*Store the image of the glyphs*/ +static LV_ATTRIBUTE_LARGE_CONST const uint8_t glyph_bitmap[] = { + /* U+0025 "%" */ + 0x1f, 0x80, 0x7, 0x3f, 0xc0, 0xe, 0x7f, 0xe0, + 0x1c, 0xf0, 0xf0, 0x1c, 0xe0, 0x70, 0x38, 0xe0, + 0x70, 0x70, 0xe0, 0x70, 0x70, 0xe0, 0x70, 0xe0, + 0xe0, 0x71, 0xc0, 0xe0, 0x71, 0xc0, 0xf0, 0xf3, + 0x80, 0x7f, 0xe7, 0x0, 0x3f, 0xc7, 0x0, 0x1f, + 0x8e, 0x0, 0x0, 0x1c, 0x0, 0x0, 0x3c, 0x0, + 0x0, 0x38, 0x0, 0x0, 0x71, 0xf8, 0x0, 0xe3, + 0xfc, 0x0, 0x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x3, 0xfc, 0x0, 0x7f, 0xe0, + 0xf, 0xff, 0x3, 0xe0, 0x7c, 0x3c, 0x3, 0xc7, + 0x80, 0x1e, 0xf0, 0x0, 0xff, 0x0, 0xf, 0xf0, + 0x0, 0xff, 0x0, 0xf, 0xf0, 0x0, 0xff, 0x80, + 0x1f, 0x7c, 0x3, 0xe7, 0xe0, 0x7e, 0x3f, 0xff, + 0xc0, 0xff, 0xf0, 0x3, 0xfc, 0x0, + + /* U+0039 "9" */ + 0x3, 0xf8, 0x0, 0xff, 0xf0, 0x1f, 0xff, 0x83, + 0xe0, 0xfc, 0x7c, 0x3, 0xe7, 0x80, 0x1e, 0xf8, + 0x1, 0xff, 0x0, 0xf, 0xf0, 0x0, 0xff, 0x0, + 0xf, 0xf0, 0x0, 0xff, 0x0, 0xf, 0xf8, 0x1, + 0xf7, 0x80, 0x1e, 0x7c, 0x3, 0xe3, 0xe0, 0x7e, + 0x3f, 0xff, 0xc1, 0xff, 0xfc, 0x7, 0xe7, 0x80, + 0x0, 0xf8, 0x0, 0xf, 0x0, 0x1, 0xe0, 0x0, + 0x1e, 0x0, 0x3, 0xc0, 0x0, 0x3c, 0x0, 0x7, + 0x80, 0x0, 0xf8, 0x0, 0xf, 0x0, 0x1, 0xe0, + 0x0, 0x1e, 0x0, 0x3, 0xc0, 0x0, + + /* U+003A ":" */ + 0x7d, 0xff, 0xff, 0xff, 0xef, 0x80, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, + 0xf7, 0xff, 0xff, 0xff, 0xbe +}; + + +/*--------------------- + * 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 = 403, .box_w = 24, .box_h = 31, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 93, .adv_w = 403, .box_w = 20, .box_h = 20, .ofs_x = 3, .ofs_y = 4}, + {.bitmap_index = 143, .adv_w = 403, .box_w = 13, .box_h = 3, .ofs_x = 6, .ofs_y = 12}, + {.bitmap_index = 148, .adv_w = 403, .box_w = 19, .box_h = 31, .ofs_x = 3, .ofs_y = 0}, + {.bitmap_index = 222, .adv_w = 403, .box_w = 19, .box_h = 31, .ofs_x = 4, .ofs_y = 0}, + {.bitmap_index = 296, .adv_w = 403, .box_w = 19, .box_h = 31, .ofs_x = 3, .ofs_y = 0}, + {.bitmap_index = 370, .adv_w = 403, .box_w = 19, .box_h = 31, .ofs_x = 3, .ofs_y = 0}, + {.bitmap_index = 444, .adv_w = 403, .box_w = 18, .box_h = 31, .ofs_x = 3, .ofs_y = 0}, + {.bitmap_index = 514, .adv_w = 403, .box_w = 18, .box_h = 31, .ofs_x = 3, .ofs_y = 0}, + {.bitmap_index = 584, .adv_w = 403, .box_w = 20, .box_h = 31, .ofs_x = 3, .ofs_y = 0}, + {.bitmap_index = 662, .adv_w = 403, .box_w = 20, .box_h = 31, .ofs_x = 3, .ofs_y = 0}, + {.bitmap_index = 740, .adv_w = 403, .box_w = 20, .box_h = 31, .ofs_x = 3, .ofs_y = 0}, + {.bitmap_index = 818, .adv_w = 403, .box_w = 20, .box_h = 31, .ofs_x = 3, .ofs_y = 0}, + {.bitmap_index = 896, .adv_w = 403, .box_w = 7, .box_h = 24, .ofs_x = 9, .ofs_y = 0} +}; + +/*--------------------- + * CHARACTER MAPPING + *--------------------*/ + +static const uint8_t glyph_id_ofs_list_0[] = { + 0, 0, 0, 0, 0, 0, 1, 0, + 2, 0, 0, 3, 4, 5, 6, 7, + 8, 9, 10, 11, 12, 13 +}; + +/*Collect the unicode lists and glyph_id offsets*/ +static const lv_font_fmt_txt_cmap_t cmaps[] = +{ + { + .range_start = 37, .range_length = 22, .glyph_id_start = 1, + .unicode_list = NULL, .glyph_id_ofs_list = glyph_id_ofs_list_0, .list_length = 22, .type = LV_FONT_FMT_TXT_CMAP_FORMAT0_FULL + } +}; + + + +/*-------------------- + * 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 jetbrains_mono_42 = { +#else +lv_font_t jetbrains_mono_42 = { +#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 = 31, /*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 = -7, + .underline_thickness = 2, +#endif + .dsc = &font_dsc /*The custom font data. Will be accessed by `get_glyph_bitmap/dsc` */ +}; + + + +#endif /*#if JETBRAINS_MONO_42*/ + -- cgit v1.2.3