kopia lustrzana https://github.com/raspberrypi/pico-playground
213 wiersze
6.9 KiB
C
213 wiersze
6.9 KiB
C
#include "font.h"
|
|
|
|
/*******************************************************************************
|
|
* Size: 18 px
|
|
* Bpp: 4
|
|
* Opts:
|
|
******************************************************************************/
|
|
|
|
#ifndef LCD18
|
|
#define LCD18 1
|
|
#endif
|
|
|
|
#if LCD18
|
|
|
|
/*-----------------
|
|
* BITMAPS
|
|
*----------------*/
|
|
|
|
/*Store the image of the glyphs*/
|
|
static LV_ATTRIBUTE_LARGE_CONST const uint8_t gylph_bitmap[] = {
|
|
/* U+2E "." */
|
|
0x3, 0x11, 0xf7,
|
|
|
|
/* U+30 "0" */
|
|
0x1, 0x9b, 0xbb, 0xb8, 0x30, 0x3a, 0xcc, 0xcb,
|
|
0xb8, 0x7, 0xe0, 0x0, 0xe, 0x70, 0x8c, 0x0,
|
|
0x0, 0xf4, 0xa, 0xc0, 0x0, 0xf, 0x40, 0xa3,
|
|
0x7, 0x20, 0xb1, 0x5, 0x2, 0xc5, 0x8, 0x0,
|
|
0xf4, 0x0, 0x7, 0xe0, 0xf, 0x40, 0x0, 0x8c,
|
|
0x2, 0xf3, 0x0, 0xa, 0xc0, 0x4f, 0x33, 0x33,
|
|
0x96, 0x3, 0xbe, 0xff, 0xff, 0x40,
|
|
|
|
/* U+31 "1" */
|
|
0x19, 0xb8, 0x51, 0x8c, 0x9b, 0x0, 0xc, 0xa0,
|
|
0x0, 0xc8, 0x0, 0xe, 0x70, 0x0, 0x93, 0x0,
|
|
0x6, 0x20, 0x3, 0xf1, 0x0, 0x4f, 0x0, 0x7,
|
|
0xe0, 0x0, 0x8c, 0x0, 0x5, 0x90,
|
|
|
|
/* U+32 "2" */
|
|
0x1, 0x9b, 0xbb, 0xb8, 0x30, 0x18, 0xcc, 0xcb,
|
|
0xb8, 0x0, 0x0, 0x0, 0xf, 0x60, 0x0, 0x0,
|
|
0x0, 0xf4, 0x0, 0x0, 0x0, 0x1f, 0x40, 0x5,
|
|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x3, 0xbe, 0xff, 0xff, 0x40,
|
|
|
|
/* U+39 "9" */
|
|
0x0, 0x9b, 0xbb, 0xb7, 0x40, 0x3a, 0xcc, 0xcc,
|
|
0xb8, 0x5, 0xf0, 0x0, 0xc, 0x80, 0x8c, 0x0,
|
|
0x0, 0xf5, 0x8, 0xc0, 0x0, 0xf, 0x40, 0x98,
|
|
0x77, 0x77, 0xb3, 0x0, 0xbc, 0xcc, 0xc7, 0x0,
|
|
0x0, 0x0, 0x5, 0xf0, 0x0, 0x0, 0x0, 0x8c,
|
|
0x0, 0x0, 0x0, 0x8, 0xc0, 0x2, 0x33, 0x33,
|
|
0x98, 0x3, 0xff, 0xff, 0xff, 0x40,
|
|
|
|
/* U+3A ":" */
|
|
0x3, 0x60, 0x7, 0xb1, 0x0, 0x0, 0x0, 0x0,
|
|
0x0, 0x0, 0x3, 0x10, 0x1f, 0x70
|
|
};
|
|
|
|
|
|
/*---------------------
|
|
* GLYPH DESCRIPTION
|
|
*--------------------*/
|
|
|
|
static const lv_font_fmt_txt_glyph_dsc_t glyph_dsc[] = {
|
|
{.bitmap_index = 0, .adv_w = 0, .box_h = 0, .box_w = 0, .ofs_x = 0, .ofs_y = 0} /* id = 0 reserved */,
|
|
{.bitmap_index = 0, .adv_w = 83, .box_h = 2, .box_w = 3, .ofs_x = 1, .ofs_y = 0},
|
|
{.bitmap_index = 3, .adv_w = 160, .box_h = 12, .box_w = 9, .ofs_x = 1, .ofs_y = 0},
|
|
{.bitmap_index = 57, .adv_w = 115, .box_h = 12, .box_w = 5, .ofs_x = 2, .ofs_y = 0},
|
|
{.bitmap_index = 87, .adv_w = 160, .box_h = 12, .box_w = 9, .ofs_x = 1, .ofs_y = 0},
|
|
{.bitmap_index = 141, .adv_w = 160, .box_h = 12, .box_w = 9, .ofs_x = 1, .ofs_y = 0},
|
|
{.bitmap_index = 195, .adv_w = 160, .box_h = 12, .box_w = 8, .ofs_x = 2, .ofs_y = 0},
|
|
{.bitmap_index = 243, .adv_w = 160, .box_h = 12, .box_w = 8, .ofs_x = 1, .ofs_y = 0},
|
|
{.bitmap_index = 291, .adv_w = 161, .box_h = 12, .box_w = 9, .ofs_x = 1, .ofs_y = 0},
|
|
{.bitmap_index = 345, .adv_w = 160, .box_h = 12, .box_w = 8, .ofs_x = 2, .ofs_y = 0},
|
|
{.bitmap_index = 393, .adv_w = 160, .box_h = 12, .box_w = 9, .ofs_x = 1, .ofs_y = 0},
|
|
{.bitmap_index = 447, .adv_w = 161, .box_h = 12, .box_w = 9, .ofs_x = 1, .ofs_y = 0},
|
|
{.bitmap_index = 501, .adv_w = 83, .box_h = 7, .box_w = 4, .ofs_x = 1, .ofs_y = 0}
|
|
};
|
|
|
|
/*---------------------
|
|
* CHARACTER MAPPING
|
|
*--------------------*/
|
|
|
|
//static const uint8_t glyph_id_ofs_list_0[] = {
|
|
// 0, 0, 1, 2, 3, 4, 5, 6,
|
|
// 7, 8, 9, 10, 11
|
|
//};
|
|
|
|
/*Collect the unicode lists and glyph_id offsets*/
|
|
static const lv_font_fmt_txt_cmap_t cmaps[] =
|
|
{
|
|
{
|
|
.range_start = 46, .range_length = 13, .type = LV_FONT_FMT_TXT_CMAP_FORMAT0_FULL,
|
|
.glyph_id_start = 1,
|
|
}
|
|
};
|
|
|
|
/*-----------------
|
|
* KERNING
|
|
*----------------*/
|
|
|
|
|
|
/*Pair left and right glyphs for kerning*/
|
|
//static const uint8_t kern_pair_glyph_ids[] =
|
|
// {
|
|
// 1, 3,
|
|
// 1, 6,
|
|
// 12, 3
|
|
// };
|
|
|
|
///* Kerning between the respective left and right glyphs
|
|
// * 4.4 format which needs to scaled with `kern_scale`*/
|
|
//static const int8_t kern_pair_values[] =
|
|
// {
|
|
// -32, -32, -32
|
|
// };
|
|
//
|
|
///*Collect the kern pair's data in one place*/
|
|
//static const lv_font_fmt_txt_kern_pair_t kern_pairs =
|
|
// {
|
|
// .glyph_ids = kern_pair_glyph_ids,
|
|
// .values = kern_pair_values,
|
|
// .pair_cnt = 3,
|
|
// .glyph_ids_size = 0
|
|
// };
|
|
|
|
/*--------------------
|
|
* ALL CUSTOM DATA
|
|
*--------------------*/
|
|
|
|
/*Store all the custom data of the font*/
|
|
static lv_font_fmt_txt_dsc_t font_dsc = {
|
|
.glyph_bitmap = gylph_bitmap,
|
|
.glyph_dsc = glyph_dsc,
|
|
.cmaps = cmaps,
|
|
.cmap_num = 1,
|
|
.bpp = 4,
|
|
|
|
// .kern_scale = 16,
|
|
// .kern_dsc = &kern_pairs,
|
|
// .kern_classes = 0
|
|
};
|
|
|
|
|
|
/*-----------------
|
|
* PUBLIC FONT
|
|
*----------------*/
|
|
|
|
/*Initialize a public general font descriptor*/
|
|
const lv_font_t lcd18 = {
|
|
.dsc = &font_dsc, /*The custom font data. Will be accessed by `get_glyph_bitmap/dsc` */
|
|
// .get_glyph_bitmap = lv_font_get_bitmap_fmt_txt, /*Function pointer to get glyph's bitmap*/
|
|
// .get_glyph_dsc = lv_font_get_glyph_dsc_fmt_txt, /*Function pointer to get glyph's data*/
|
|
.line_height = 13, /*The maximum line height required by the font*/
|
|
.base_line = 1, /*Baseline measured from the bottom of the line*/
|
|
};
|
|
|
|
#endif /*#if LCD18*/
|