Description
I want to create a LVGL font engine to display CJK because hardware limit. the font’s bitmap was stored in another flash and I get them by SPI. but it not work, either ascii or CJK.
What MCU/Processor/Board and compiler are you using?
RP2040 with it’s C-SDK
What do you want to achieve?
get them to work.
What have you tried so far?
Code to reproduce
font.c
bool kbt_get_glyph_dsc(const lv_font_t *, lv_font_glyph_dsc_t *, uint32_t, uint32_t);
const void *kbt_get_glyph_bitmap(lv_font_glyph_dsc_t *, lv_draw_buf_t *);
lv_font_t *font_init();
lv_font_t *font_init()
{
static lv_font_t font =
{
.get_glyph_dsc = kbt_get_glyph_dsc,
.get_glyph_bitmap = kbt_get_glyph_bitmap,
.line_height = 1 << 4,
.base_line = 0,
};
return &font;
}
bool kbt_get_glyph_dsc(const lv_font_t *font, lv_font_glyph_dsc_t *dsc_out, uint32_t unicode_letter, uint32_t next_unicode_letter)
{
(void)font;
(void)next_unicode_letter;
dsc_out->box_h = 1 << 4;
dsc_out->ofs_x = 1 << 4;
dsc_out->ofs_y = 1 << 4;
dsc_out->format = LV_FONT_GLYPH_FORMAT_A1;
dsc_out->gid.index = unicode_letter;
if(dsc_out->gid.index < 0x7F)
dsc_out->box_w = dsc_out->adv_w = 1 << 3;
else if (dsc_out->gid.index > 0X4E00 && dsc_out->gid.index < 0X9FFF). // CJK font
dsc_out->box_w = dsc_out->adv_w = 1 << 4;
else
return false;
return true;
}
const void *kbt_get_glyph_bitmap(lv_font_glyph_dsc_t *dsc, lv_draw_buf_t *buf)
{
// save bipmap data to buf->data as LVGL's description
uint8_t sciibuf[16];
uint8_t cjkbuf[32];
return asciibuf;
The problem is how should I fill bytes to cjkbuf and asciibuf?