LVGL V8之显示中文

文章目录[隐藏]

使用在线工具转换字体

在线转换工具

  • 转换“长风破浪会有时\n直挂云帆济沧海”
    在这里插入图片描述
  • 转换好的文件内容
/*******************************************************************************
 * Size: 18 px
 * Bpp: 4
 * Opts:
 ******************************************************************************/

#ifdef LV_LVGL_H_INCLUDE_SIMPLE
#include "lvgl.h"
#else
#include "lvgl/lvgl.h"
#endif

#ifndef MYFONT
#define MYFONT 1
#endif

#if MYFONT

 /*-----------------
  *    BITMAPS
  *----------------*/

  /*Store the image of the glyphs*/
static LV_ATTRIBUTE_LARGE_CONST const uint8_t glyph_bitmap[] = {
    /* U+005C "\\" */
    0x9f, 0xc0, 0x0, 0x0, 0x4f, 0xf2, 0x0, 0x0,
    0xe, 0xf7, 0x0, 0x0, 0x9, 0xfd, 0x0, 0x0,
    0x3, 0xff, 0x30, 0x0, 0x0, 0xdf, 0x80, 0x0,
    0x0, 0x8f, 0xe0, 0x0, 0x0, 0x2f, 0xf4, 0x0,
    0x0, 0xc, 0xf9, 0x0, 0x0, 0x7, 0xfe, 0x0,
    0x0, 0x1, 0xff, 0x40, 0x0, 0x0, 0xcf, 0xa0,
    0x0, 0x0, 0x6f, 0xf0, 0x0, 0x0, 0x1f, 0xf5,

    /* U+006E "n" */
    0xdf, 0x65, 0xdf, 0xd5, 0xd, 0xfc, 0xff, 0xff,
    0xf2, 0xdf, 0xfc, 0x6a, 0xff, 0x9d, 0xff, 0x10,
    0xe, 0xfc, 0xdf, 0xb0, 0x0, 0xbf, 0xdd, 0xfa,
    0x0, 0xa, 0xfd, 0xdf, 0xa0, 0x0, 0xaf, 0xdd,
    0xfa, 0x0, 0xa, 0xfd, 0xdf, 0xa0, 0x0, 0xaf,
    0xdd, 0xfa, 0x0, 0xa, 0xfd,

    /* U+4E91 "云" */
    0x8, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x80,
    0x8, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x80,
    0x1, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x10,
    0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
    0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
    0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44,
    0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
    0xde, 0xee, 0xef, 0xff, 0xee, 0xee, 0xee, 0xed,
    0x0, 0x0, 0xd, 0xfd, 0x0, 0x0, 0x0, 0x0,
    0x0, 0x0, 0x8f, 0xf3, 0x0, 0x6c, 0x0, 0x0,
    0x0, 0x2, 0xff, 0x90, 0x1, 0xff, 0x90, 0x0,
    0x0, 0xd, 0xfd, 0x0, 0x0, 0x5f, 0xf4, 0x0,
    0x0, 0xbf, 0xf3, 0x0, 0x0, 0xb, 0xfe, 0x10,
    0x1b, 0xff, 0xb7, 0x8a, 0xcd, 0xff, 0xff, 0xa0,
    0x2f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf4,
    0xd, 0xec, 0xba, 0x87, 0x54, 0x21, 0xb, 0xf8,
    0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x2, 0x50,

    /* U+4F1A "会" */
    0x0, 0x0, 0x0, 0x2, 0xef, 0x90, 0x0, 0x0,
    0x0, 0x0, 0x0, 0x0, 0x2e, 0xff, 0xf9, 0x0,
    0x0, 0x0, 0x0, 0x0, 0x4, 0xef, 0xd8, 0xff,
    0xb1, 0x0, 0x0, 0x0, 0x0, 0x9f, 0xfc, 0x10,
    0x5f, 0xfe, 0x50, 0x0, 0x0, 0x7e, 0xff, 0x80,
    0x0, 0x2, 0xcf, 0xfb, 0x40, 0xe, 0xff, 0xff,
    0xdd, 0xdd, 0xdd, 0xde, 0xff, 0xf6, 0x9, 0xf7,
    0x5f, 0xff, 0xff, 0xff, 0xfb, 0x2c, 0xf1, 0x1,
    0x10, 0x1, 0x11, 0x11, 0x11, 0x11, 0x0, 0x20,
    0x0, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
    0x0, 0x4, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
    0xff, 0xc0, 0x4, 0xff, 0xff, 0xff, 0xff, 0xff,
    0xff, 0xff, 0xb0, 0x0, 0x0, 0x7, 0xff, 0x40,
    0x7, 0xf5, 0x0, 0x0, 0x0, 0x0, 0x4f, 0xf8,
    0x0, 0xa, 0xff, 0x30, 0x0, 0x0, 0x4, 0xff,
    0xa2, 0x34, 0x68, 0xff, 0xe1, 0x0, 0x0, 0x3f,
    0xff, 0xff, 0xff, 0xff, 0xff, 0xfc, 0x0, 0x0,
    0xf, 0xff, 0xec, 0xb9, 0x87, 0x56, 0xfc, 0x10,
    0x0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x40,
    0x0,

    /* U+5E06 "帆" */
    0x0, 0xaf, 0x40, 0xc, 0xff, 0xff, 0xfd, 0x0,
    0x0, 0xa, 0xf4, 0x0, 0xcf, 0xff, 0xff, 0xd0,
    0x0, 0x22, 0xbf, 0x52, 0x1c, 0xf3, 0x22, 0xfd,
    0x0, 0xe, 0xff, 0xff, 0xf8, 0xcf, 0x10, 0x1f,
    0xd0, 0x0, 0xef, 0xff, 0xef, 0x8c, 0xf1, 0x1,
    0xfd, 0x0, 0xe, 0x99, 0xf2, 0xf8, 0xcf, 0x77,
    0x1f, 0xd0, 0x0, 0xe9, 0x9f, 0x2f, 0x8c, 0xff,
    0xf1, 0xfd, 0x0, 0xe, 0x99, 0xf2, 0xf8, 0xcf,
    0xbf, 0x7f, 0xd0, 0x0, 0xe9, 0x9f, 0x2f, 0x8c,
    0xf5, 0xfd, 0xfd, 0x0, 0xe, 0x99, 0xf2, 0xf8,
    0xdf, 0xe, 0xff, 0xd0, 0x0, 0xe9, 0x9f, 0x2f,
    0x8e, 0xf0, 0x65, 0xfd, 0x3, 0xe, 0x99, 0xf9,
    0xf9, 0xfe, 0x0, 0x1f, 0xd1, 0xf3, 0xe9, 0x9f,
    0xcf, 0xcf, 0xb0, 0x1, 0xfd, 0x2f, 0x36, 0x49,
    0xf5, 0x7d, 0xf7, 0x0, 0x1f, 0xd3, 0xf2, 0x0,
    0x9f, 0x26, 0xfe, 0x10, 0x0, 0xff, 0xff, 0x20,
    0x9, 0xf2, 0x3e, 0x50, 0x0, 0x8, 0xff, 0xb0,
    0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
    0x0,

    /* U+6302 "挂" */
    0x0, 0x2f, 0xf0, 0x0, 0x0, 0x3f, 0xe0, 0x0,
    0x0, 0x0, 0x2f, 0xf0, 0x0, 0x0, 0x3f, 0xe0,
    0x0, 0x0, 0x1, 0x3f, 0xf1, 0xb, 0xff, 0xff,
    0xff, 0xff, 0x50, 0x1f, 0xff, 0xff, 0x7c, 0xff,
    0xff, 0xff, 0xff, 0x50, 0x1f, 0xff, 0xff, 0x70,
    0x0, 0x4f, 0xe0, 0x0, 0x0, 0x1, 0x3f, 0xf1,
    0x12, 0x22, 0x5f, 0xe2, 0x22, 0x20, 0x0, 0x2f,
    0xf1, 0x4f, 0xff, 0xff, 0xff, 0xff, 0xf3, 0x0,
    0x2f, 0xff, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xf3,
    0x16, 0xcf, 0xff, 0x50, 0x0, 0x29, 0x80, 0x0,
    0x0, 0x6f, 0xff, 0xf4, 0x0, 0x11, 0x4f, 0xe1,
    0x11, 0x0, 0x4e, 0xaf, 0xf0, 0xc, 0xff, 0xff,
    0xff, 0xff, 0x50, 0x0, 0x2f, 0xf0, 0xc, 0xff,
    0xff, 0xff, 0xff, 0x50, 0x0, 0x2f, 0xf0, 0x0,
    0x0, 0x3f, 0xe0, 0x0, 0x0, 0x0, 0x2f, 0xf0,
    0x22, 0x22, 0x5f, 0xe2, 0x22, 0x20, 0x3, 0x5f,
    0xf1, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf6, 0xc,
    0xff, 0xe0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf5,
    0x9, 0xfe, 0x60, 0x0, 0x0, 0x0, 0x0, 0x0,
    0x0,

    /* U+65F6 "时" */
    0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xdf, 0x70,
    0xe, 0xff, 0xff, 0xf2, 0x0, 0x0, 0xd, 0xf7,
    0x0, 0xef, 0xff, 0xff, 0x20, 0x0, 0x0, 0xdf,
    0x70, 0xe, 0xf6, 0x4e, 0xf2, 0xef, 0xff, 0xff,
    0xff, 0xf2, 0xef, 0x20, 0xef, 0x2e, 0xff, 0xff,
    0xff, 0xff, 0x2e, 0xf2, 0xe, 0xf2, 0x34, 0x44,
    0x4d, 0xf9, 0x40, 0xef, 0x42, 0xef, 0x20, 0x80,
    0x0, 0xdf, 0x70, 0xe, 0xff, 0xff, 0xf2, 0xaf,
    0x90, 0xd, 0xf7, 0x0, 0xef, 0xff, 0xff, 0x22,
    0xff, 0x30, 0xdf, 0x70, 0xe, 0xf2, 0xe, 0xf2,
    0x8, 0xfc, 0xd, 0xf7, 0x0, 0xef, 0x20, 0xef,
    0x20, 0xd, 0xf3, 0xdf, 0x70, 0xe, 0xf2, 0xe,
    0xf2, 0x0, 0x42, 0xd, 0xf7, 0x0, 0xef, 0x20,
    0xef, 0x20, 0x0, 0x0, 0xdf, 0x70, 0xe, 0xff,
    0xff, 0xf2, 0x0, 0x33, 0x3e, 0xf6, 0x0, 0xef,
    0xff, 0xff, 0x20, 0xf, 0xff, 0xff, 0x40, 0x3,
    0x33, 0x33, 0x30, 0x0, 0xcf, 0xfe, 0x90, 0x0,

    /* U+6709 "有" */
    0x0, 0x0, 0x0, 0x3e, 0xc1, 0x0, 0x0, 0x0,
    0x0, 0x1, 0x22, 0x22, 0xaf, 0xd2, 0x22, 0x22,
    0x22, 0x20, 0xb, 0xff, 0xff, 0xff, 0xff, 0xff,
    0xff, 0xff, 0xf1, 0x9, 0xdd, 0xdf, 0xff, 0xdd,
    0xdd, 0xdd, 0xdd, 0xd1, 0x0, 0x0, 0x6f, 0xf3,
    0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x3, 0xff,
    0xff, 0xff, 0xff, 0xff, 0xf6, 0x0, 0x0, 0x3e,
    0xff, 0xee, 0xee, 0xee, 0xef, 0xf6, 0x0, 0x4,
    0xff, 0xfd, 0x0, 0x0, 0x0, 0xc, 0xf6, 0x0,
    0x4f, 0xff, 0xff, 0xdd, 0xdd, 0xdd, 0xdf, 0xf6,
    0x0, 0x1f, 0xc6, 0xff, 0xff, 0xff, 0xff, 0xff,
    0xf6, 0x0, 0x5, 0x5, 0xfd, 0x0, 0x0, 0x0,
    0xc, 0xf6, 0x0, 0x0, 0x5, 0xff, 0xdd, 0xdd,
    0xdd, 0xdf, 0xf6, 0x0, 0x0, 0x5, 0xff, 0xff,
    0xff, 0xff, 0xff, 0xf6, 0x0, 0x0, 0x5, 0xfd,
    0x0, 0x0, 0x0, 0xc, 0xf6, 0x0, 0x0, 0x5,
    0xfd, 0x0, 0x0, 0x10, 0xd, 0xf6, 0x0, 0x0,
    0x5, 0xfd, 0x0, 0x0, 0x7f, 0xff, 0xf4, 0x0,
    0x0, 0x4, 0xfc, 0x0, 0x0, 0x3e, 0xff, 0xa0,
    0x0,

    /* U+6CA7 "沧" */
    0x0, 0x48, 0x0, 0x0, 0x2, 0xff, 0x40, 0x0,
    0x0, 0x1, 0xef, 0xc1, 0x0, 0xb, 0xff, 0xd0,
    0x0, 0x0, 0x0, 0x6f, 0xfe, 0x20, 0x8f, 0xfe,
    0xfa, 0x0, 0x0, 0x0, 0x3, 0xec, 0x6, 0xff,
    0x84, 0xff, 0x90, 0x0, 0x4, 0x40, 0x22, 0x7f,
    0xfb, 0x0, 0x7f, 0xfb, 0x10, 0x1e, 0xfa, 0x2c,
    0xff, 0xb1, 0x0, 0x8, 0xff, 0xe4, 0x1b, 0xff,
    0xef, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf2, 0x0,
    0x6f, 0xb7, 0xaf, 0xff, 0xff, 0xff, 0xf3, 0x60,
    0x0, 0x2, 0x10, 0x4f, 0xe0, 0x0, 0x2f, 0xf0,
    0x0, 0x0, 0x4, 0x30, 0x4f, 0xe0, 0x0, 0x4f,
    0xf0, 0x0, 0x0, 0xd, 0xf7, 0x4f, 0xe0, 0xbc,
    0xef, 0xd0, 0x0, 0x0, 0x4f, 0xf2, 0x4f, 0xe0,
    0xaf, 0xff, 0x91, 0x0, 0x0, 0xbf, 0xc0, 0x4f,
    0xe0, 0x1, 0x10, 0xaf, 0x90, 0x3, 0xff, 0x60,
    0x4f, 0xf1, 0x0, 0x1, 0xdf, 0x90, 0xa, 0xfe,
    0x0, 0x2f, 0xff, 0xff, 0xff, 0xff, 0x60, 0x8,
    0xf7, 0x0, 0x8, 0xef, 0xff, 0xff, 0xea, 0x0,
    0x0, 0x0, 0x0, 0x0, 0x0, 0x11, 0x10, 0x0,
    0x0,

    /* U+6D4E "济" */
    0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0,
    0x0, 0x0, 0xa4, 0x0, 0x0, 0x5, 0xef, 0x0,
    0x0, 0x0, 0x7, 0xff, 0x70, 0x44, 0x44, 0xff,
    0x84, 0x44, 0x30, 0x0, 0xaf, 0xf9, 0xff, 0xff,
    0xff, 0xff, 0xff, 0xe0, 0x0, 0x7, 0xd2, 0xcf,
    0xfe, 0xcc, 0xcf, 0xfd, 0xb0, 0x9, 0x60, 0x0,
    0x8, 0xfe, 0x10, 0x9f, 0xd0, 0x0, 0x5f, 0xfb,
    0x10, 0x0, 0xbf, 0xeb, 0xfe, 0x20, 0x0, 0x7,
    0xff, 0xd0, 0x0, 0x1e, 0xff, 0xf5, 0x0, 0x0,
    0x0, 0x3e, 0x53, 0x7b, 0xff, 0xff, 0xff, 0xd8,
    0x41, 0x0, 0x1, 0xe, 0xff, 0xe9, 0x20, 0x7d,
    0xff, 0xf6, 0x0, 0x3e, 0x96, 0x99, 0xca, 0x0,
    0x3b, 0xc8, 0xc0, 0x0, 0x9f, 0xd0, 0x6, 0xfc,
    0x0, 0x4f, 0xd0, 0x0, 0x0, 0xef, 0x80, 0x8,
    0xfa, 0x0, 0x4f, 0xd0, 0x0, 0x5, 0xff, 0x20,
    0xd, 0xf6, 0x0, 0x4f, 0xd0, 0x0, 0xa, 0xfd,
    0x0, 0x9f, 0xf1, 0x0, 0x4f, 0xd0, 0x0, 0xf,
    0xf7, 0x1c, 0xff, 0x60, 0x0, 0x4f, 0xd0, 0x0,
    0x2, 0x81, 0xb, 0xf6, 0x0, 0x0, 0x4f, 0xd0,
    0x0, 0x0, 0x0, 0x0, 0x20, 0x0, 0x0, 0x0,
    0x0, 0x0,

    /* U+6D6A "浪" */
    0x0, 0x0, 0x0, 0x0, 0x4, 0x75, 0x0, 0x0,
    0x0, 0x1, 0xd4, 0x0, 0x0, 0x8, 0xfe, 0x0,
    0x0, 0x0, 0x9, 0xff, 0x82, 0xdd, 0xdd, 0xff,
    0xdd, 0xdd, 0x0, 0x0, 0xaf, 0xf7, 0xff, 0xff,
    0xff, 0xff, 0xff, 0x0, 0x0, 0x7, 0xa2, 0xfe,
    0x11, 0x11, 0x11, 0xff, 0x0, 0xc, 0x70, 0x2,
    0xff, 0x99, 0x99, 0x99, 0xff, 0x0, 0x6f, 0xfa,
    0x2, 0xff, 0xff, 0xff, 0xff, 0xff, 0x0, 0xa,
    0xff, 0xc2, 0xfe, 0x22, 0x22, 0x22, 0xff, 0x0,
    0x0, 0x9f, 0x92, 0xfe, 0x0, 0x0, 0x0, 0xff,
    0x0, 0x0, 0x8, 0x12, 0xff, 0xff, 0xff, 0xff,
    0xff, 0x0, 0x0, 0x3, 0x2, 0xff, 0xde, 0xfe,
    0xdd, 0xde, 0x0, 0x0, 0x4f, 0xd2, 0xfe, 0x4,
    0xfd, 0x0, 0x7f, 0x60, 0x0, 0x9f, 0xb2, 0xfe,
    0x0, 0xcf, 0x9c, 0xff, 0x70, 0x0, 0xef, 0x62,
    0xfe, 0x0, 0x3f, 0xff, 0xb2, 0x0, 0x5, 0xff,
    0x12, 0xfe, 0x4a, 0x76, 0xff, 0xa1, 0x0, 0xb,
    0xfb, 0x6, 0xff, 0xff, 0xa0, 0x6f, 0xff, 0xb1,
    0xe, 0xf5, 0x6, 0xff, 0xe8, 0x20, 0x2, 0xcf,
    0xd0, 0x0, 0x50, 0x0, 0xa4, 0x0, 0x0, 0x0,
    0x3, 0x30,

    /* U+6D77 "海" */
    0x0, 0x0, 0x0, 0x0, 0x10, 0x0, 0x0, 0x0,
    0x0, 0x1, 0xc3, 0x0, 0x7, 0xfb, 0x0, 0x0,
    0x0, 0x0, 0x9, 0xff, 0x60, 0x1f, 0xff, 0xff,
    0xff, 0xff, 0xf0, 0x0, 0x9f, 0xf4, 0xaf, 0xff,
    0xff, 0xff, 0xff, 0xf0, 0x0, 0x6, 0xa6, 0xff,
    0x30, 0x0, 0x0, 0x0, 0x0, 0x8, 0x60, 0xe,
    0xff, 0xee, 0xee, 0xee, 0xee, 0x40, 0x3f, 0xfa,
    0x4, 0xff, 0xff, 0xff, 0xff, 0xff, 0x30, 0x6,
    0xff, 0xc0, 0x9f, 0x62, 0xfc, 0x10, 0xcf, 0x30,
    0x0, 0x3e, 0x50, 0xbf, 0x50, 0x8f, 0x80, 0xdf,
    0x20, 0x0, 0x1, 0x1d, 0xff, 0xed, 0xdf, 0xdd,
    0xff, 0xe6, 0x0, 0x35, 0x2f, 0xff, 0xff, 0xff,
    0xff, 0xff, 0xf7, 0x0, 0x9f, 0x80, 0xff, 0x8,
    0xf9, 0x0, 0xff, 0x0, 0x0, 0xdf, 0x42, 0xfd,
    0x1, 0xcf, 0x41, 0xff, 0x0, 0x2, 0xff, 0x4,
    0xff, 0xff, 0xff, 0xff, 0xff, 0xf3, 0x6, 0xfb,
    0x5, 0xee, 0xee, 0xee, 0xef, 0xff, 0xe3, 0xb,
    0xf7, 0x0, 0x0, 0x0, 0x10, 0x8, 0xfa, 0x0,
    0xf, 0xf3, 0x0, 0x0, 0x0, 0xee, 0xdf, 0xf7,
    0x0, 0x5, 0xa0, 0x0, 0x0, 0x0, 0xae, 0xff,
    0xb0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
    0x0, 0x0, 0x0,

    /* U+76F4 "直" */
    0x0, 0x0, 0x0, 0x1, 0xff, 0x10, 0x0, 0x0,
    0x0, 0xa, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
    0xff, 0xa0, 0x8, 0xdd, 0xdd, 0xdd, 0xff, 0xdd,
    0xdd, 0xdd, 0x80, 0x0, 0x2, 0x22, 0x23, 0xff,
    0x32, 0x22, 0x20, 0x0, 0x0, 0x2f, 0xff, 0xff,
    0xff, 0xff, 0xff, 0xf3, 0x0, 0x0, 0x2f, 0xf9,
    0x99, 0x99, 0x99, 0x9f, 0xf3, 0x0, 0x0, 0x2f,
    0xf7, 0x77, 0x77, 0x77, 0x7f, 0xf3, 0x0, 0x0,
    0x2f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf3, 0x0,
    0x0, 0x2f, 0xf0, 0x0, 0x0, 0x0, 0xf, 0xf3,
    0x0, 0x0, 0x2f, 0xff, 0xff, 0xff, 0xff, 0xff,
    0xf3, 0x0, 0x0, 0x2f, 0xf8, 0x88, 0x88, 0x88,
    0x8f, 0xf3, 0x0, 0x0, 0x2f, 0xf8, 0x88, 0x88,
    0x88, 0x8f, 0xf3, 0x0, 0x0, 0x2f, 0xff, 0xff,
    0xff, 0xff, 0xff, 0xf3, 0x0, 0x0, 0x2f, 0xf0,
    0x0, 0x0, 0x0, 0xf, 0xf3, 0x0, 0x2c, 0xdf,
    0xfc, 0xcc, 0xcc, 0xcc, 0xcf, 0xfd, 0xc2, 0x2f,
    0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf2,

    /* U+7834 "破" */
    0x0, 0x0, 0x0, 0x0, 0x0, 0xb, 0xf4, 0x0,
    0x0, 0xd, 0xee, 0xee, 0xb0, 0x11, 0x1c, 0xf4,
    0x11, 0x10, 0xf, 0xff, 0xff, 0xd7, 0xff, 0xff,
    0xff, 0xff, 0xf2, 0x1, 0x5f, 0xb1, 0x17, 0xff,
    0xff, 0xff, 0xff, 0xf1, 0x0, 0x8f, 0x70, 0x7,
    0xf7, 0xb, 0xf4, 0x3f, 0xe0, 0x0, 0xdf, 0x30,
    0x7, 0xf7, 0xb, 0xf4, 0x4c, 0x90, 0x2, 0xff,
    0xdd, 0x67, 0xfa, 0x4c, 0xf7, 0x44, 0x10, 0xb,
    0xff, 0xff, 0x87, 0xff, 0xff, 0xff, 0xff, 0x60,
    0x3f, 0xfc, 0x7f, 0x87, 0xff, 0xfd, 0xdd, 0xff,
    0x60, 0x8f, 0xfa, 0x3f, 0x88, 0xff, 0xf3, 0x2,
    0xff, 0x10, 0x3d, 0xfa, 0x3f, 0x89, 0xfb, 0xfb,
    0xa, 0xfa, 0x0, 0x3, 0xfa, 0x3f, 0x8b, 0xf4,
    0xdf, 0xaf, 0xf2, 0x0, 0x0, 0xfa, 0x4f, 0x8e,
    0xf1, 0x3f, 0xff, 0x80, 0x0, 0x0, 0xff, 0xff,
    0xaf, 0xd0, 0x6f, 0xff, 0xb2, 0x0, 0x0, 0xee,
    0xee, 0xff, 0xbb, 0xff, 0xbf, 0xff, 0xa2, 0x0,
    0x0, 0x1, 0xff, 0xbf, 0xf6, 0x2, 0xcf, 0xf2,
    0x0, 0x0, 0x0, 0x37, 0x1a, 0x10, 0x0, 0x4,
    0x60,

    /* U+957F "长" */
    0x0, 0xb, 0xf8, 0x0, 0x0, 0x0, 0x5, 0x70,
    0x0, 0x0, 0xb, 0xf8, 0x0, 0x0, 0x3, 0xcf,
    0xf2, 0x0, 0x0, 0xb, 0xf8, 0x0, 0x4, 0xaf,
    0xff, 0xd3, 0x0, 0x0, 0xb, 0xf8, 0x6, 0xdf,
    0xff, 0xe6, 0x0, 0x0, 0x0, 0xb, 0xf8, 0x3f,
    0xff, 0xd6, 0x0, 0x0, 0x0, 0x0, 0xb, 0xf8,
    0xc, 0xb4, 0x0, 0x0, 0x0, 0x0, 0x5, 0x5c,
    0xfa, 0x55, 0x55, 0x55, 0x55, 0x55, 0x40, 0x1f,
    0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0,
    0x1e, 0xef, 0xff, 0xee, 0xff, 0xee, 0xee, 0xee,
    0xd0, 0x0, 0xb, 0xf8, 0x0, 0xaf, 0xd0, 0x0,
    0x0, 0x0, 0x0, 0xb, 0xf8, 0x0, 0x2f, 0xf8,
    0x0, 0x0, 0x0, 0x0, 0xb, 0xf8, 0x0, 0x7,
    0xff, 0x80, 0x0, 0x0, 0x0, 0xb, 0xf8, 0x0,
    0x35, 0x9f, 0xfa, 0x10, 0x0, 0x0, 0xb, 0xf9,
    0x7d, 0xf9, 0x9, 0xff, 0xf9, 0x20, 0x0, 0x2e,
    0xff, 0xff, 0xf8, 0x0, 0x6e, 0xff, 0xf1, 0x0,
    0xe, 0xff, 0xd7, 0x10, 0x0, 0x1, 0x8f, 0x80,
    0x0, 0x7, 0xa3, 0x0, 0x0, 0x0, 0x0, 0x0,
    0x0,

    /* U+98CE "风" */
    0x0, 0xef, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe0,
    0x0, 0x0, 0xef, 0xff, 0xff, 0xff, 0xff, 0xff,
    0xe0, 0x0, 0x0, 0xef, 0x52, 0x22, 0x22, 0x22,
    0x5f, 0xe0, 0x0, 0x0, 0xef, 0x33, 0x30, 0x0,
    0xb7, 0x4f, 0xe0, 0x0, 0x0, 0xef, 0x8f, 0xd0,
    0x3, 0xff, 0x6f, 0xe0, 0x0, 0x0, 0xef, 0x4e,
    0xf9, 0xc, 0xf9, 0x4f, 0xe0, 0x0, 0x0, 0xef,
    0x34, 0xff, 0x8f, 0xf2, 0x4f, 0xe0, 0x0, 0x0,
    0xef, 0x30, 0x9f, 0xff, 0x90, 0x4f, 0xe0, 0x0,
    0x0, 0xef, 0x30, 0xe, 0xff, 0x10, 0x4f, 0xe0,
    0x0, 0x0, 0xff, 0x20, 0x3f, 0xff, 0x40, 0x4f,
    0xe0, 0x0, 0x0, 0xff, 0x10, 0xdf, 0xff, 0xd0,
    0x3f, 0xe0, 0x0, 0x2, 0xff, 0xa, 0xff, 0x4f,
    0xf9, 0x3f, 0xe2, 0xd3, 0x6, 0xfd, 0x7f, 0xf5,
    0x7, 0xff, 0x5f, 0xf4, 0xf4, 0xb, 0xfb, 0xff,
    0x90, 0x0, 0xdf, 0x9f, 0xfa, 0xf1, 0x2f, 0xf4,
    0x5b, 0x0, 0x0, 0x37, 0xc, 0xff, 0xe0, 0x8f,
    0xe0, 0x0, 0x0, 0x0, 0x0, 0x8, 0xff, 0x90,
    0x7, 0x60, 0x0, 0x0, 0x0, 0x0, 0x1, 0xcd,
    0x10
};


/*---------------------
 *  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 = 124, .box_w = 8, .box_h = 14, .ofs_x = 0, .ofs_y = 0},
    {.bitmap_index = 56, .adv_w = 174, .box_w = 9, .box_h = 10, .ofs_x = 1, .ofs_y = 0},
    {.bitmap_index = 101, .adv_w = 288, .box_w = 16, .box_h = 17, .ofs_x = 1, .ofs_y = -2},
    {.bitmap_index = 237, .adv_w = 288, .box_w = 18, .box_h = 17, .ofs_x = 0, .ofs_y = -2},
    {.bitmap_index = 390, .adv_w = 288, .box_w = 17, .box_h = 17, .ofs_x = 1, .ofs_y = -2},
    {.bitmap_index = 535, .adv_w = 288, .box_w = 18, .box_h = 17, .ofs_x = 0, .ofs_y = -2},
    {.bitmap_index = 688, .adv_w = 288, .box_w = 17, .box_h = 16, .ofs_x = 1, .ofs_y = -1},
    {.bitmap_index = 824, .adv_w = 288, .box_w = 18, .box_h = 17, .ofs_x = 0, .ofs_y = -2},
    {.bitmap_index = 977, .adv_w = 288, .box_w = 18, .box_h = 17, .ofs_x = 0, .ofs_y = -2},
    {.bitmap_index = 1130, .adv_w = 288, .box_w = 18, .box_h = 18, .ofs_x = 0, .ofs_y = -2},
    {.bitmap_index = 1292, .adv_w = 288, .box_w = 18, .box_h = 18, .ofs_x = 0, .ofs_y = -2},
    {.bitmap_index = 1454, .adv_w = 288, .box_w = 18, .box_h = 19, .ofs_x = 0, .ofs_y = -3},
    {.bitmap_index = 1625, .adv_w = 288, .box_w = 18, .box_h = 16, .ofs_x = 0, .ofs_y = -1},
    {.bitmap_index = 1769, .adv_w = 288, .box_w = 18, .box_h = 17, .ofs_x = 0, .ofs_y = -2},
    {.bitmap_index = 1922, .adv_w = 288, .box_w = 18, .box_h = 17, .ofs_x = 0, .ofs_y = -2},
    {.bitmap_index = 2075, .adv_w = 288, .box_w = 18, .box_h = 17, .ofs_x = 0, .ofs_y = -2}
};

/*---------------------
 *  CHARACTER MAPPING
 *--------------------*/

static const uint16_t unicode_list_0[] = {
    0x0, 0x12, 0x4e35, 0x4ebe, 0x5daa, 0x62a6, 0x659a, 0x66ad,
    0x6c4b, 0x6cf2, 0x6d0e, 0x6d1b, 0x7698, 0x77d8, 0x9523, 0x9872
};

/*Collect the unicode lists and glyph_id offsets*/
static const lv_font_fmt_txt_cmap_t cmaps[] =
{
    {
        .range_start = 92, .range_length = 39027, .glyph_id_start = 1,
        .unicode_list = unicode_list_0, .glyph_id_ofs_list = NULL, .list_length = 16, .type = LV_FONT_FMT_TXT_CMAP_SPARSE_TINY
    }
};

/*-----------------
 *    KERNING
 *----------------*/


 /*Pair left and right glyphs for kerning*/
static const uint8_t kern_pair_glyph_ids[] =
{
    1, 1,
    2, 1
};

/* 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[] =
{
    -31, -25
};

/*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 = 2,
    .glyph_ids_size = 0
};

/*--------------------
 *  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 = &kern_pairs,
    .kern_scale = 16,
    .cmap_num = 1,
    .bpp = 4,
    .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 myFont = {
 #else
 lv_font_t myFont = {
 #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 = 19,          /*The maximum line height required by the font*/
     .base_line = 3,             /*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)
     .underline_position = -1,
     .underline_thickness = 1,
 #endif
     .dsc = &font_dsc           /*The custom font data. Will be accessed by `get_glyph_bitmap/dsc` */
 };



 #endif /*#if MYFONT*/


  • 声明字体
LV_FONT_DECLARE(myFont)
  • 创建label并居中显示
    const char* str1 = "长风破浪会有时\n直挂云帆济沧海";
    lv_obj_t* label_dl_1 = lv_label_create(lv_scr_act(), NULL);
    lv_label_set_text(label_dl_1, str1);
    lv_obj_center(label_dl_1);
  • 设置字体
    lv_obj_set_style_text_font(label_dl_1, &myFont, 0);
    lv_obj_set_style_text_color(label_dl_1, lv_color_make(0xff, 0x00, 0x00), 0);
  • 配置编译运行字体为utf-8
#pragma execution_character_set("utf-8") 
  • 运行效果图
    在这里插入图片描述

版权声明:本文为CSDN博主「仙剑情缘」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/mygod2008ok/article/details/119845883

使用在线工具转换字体

在线转换工具

  • 转换“长风破浪会有时\n直挂云帆济沧海”
    在这里插入图片描述
  • 转换好的文件内容
/*******************************************************************************
 * Size: 18 px
 * Bpp: 4
 * Opts:
 ******************************************************************************/

#ifdef LV_LVGL_H_INCLUDE_SIMPLE
#include "lvgl.h"
#else
#include "lvgl/lvgl.h"
#endif

#ifndef MYFONT
#define MYFONT 1
#endif

#if MYFONT

 /*-----------------
  *    BITMAPS
  *----------------*/

  /*Store the image of the glyphs*/
static LV_ATTRIBUTE_LARGE_CONST const uint8_t glyph_bitmap[] = {
    /* U+005C "\\" */
    0x9f, 0xc0, 0x0, 0x0, 0x4f, 0xf2, 0x0, 0x0,
    0xe, 0xf7, 0x0, 0x0, 0x9, 0xfd, 0x0, 0x0,
    0x3, 0xff, 0x30, 0x0, 0x0, 0xdf, 0x80, 0x0,
    0x0, 0x8f, 0xe0, 0x0, 0x0, 0x2f, 0xf4, 0x0,
    0x0, 0xc, 0xf9, 0x0, 0x0, 0x7, 0xfe, 0x0,
    0x0, 0x1, 0xff, 0x40, 0x0, 0x0, 0xcf, 0xa0,
    0x0, 0x0, 0x6f, 0xf0, 0x0, 0x0, 0x1f, 0xf5,

    /* U+006E "n" */
    0xdf, 0x65, 0xdf, 0xd5, 0xd, 0xfc, 0xff, 0xff,
    0xf2, 0xdf, 0xfc, 0x6a, 0xff, 0x9d, 0xff, 0x10,
    0xe, 0xfc, 0xdf, 0xb0, 0x0, 0xbf, 0xdd, 0xfa,
    0x0, 0xa, 0xfd, 0xdf, 0xa0, 0x0, 0xaf, 0xdd,
    0xfa, 0x0, 0xa, 0xfd, 0xdf, 0xa0, 0x0, 0xaf,
    0xdd, 0xfa, 0x0, 0xa, 0xfd,

    /* U+4E91 "云" */
    0x8, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x80,
    0x8, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x80,
    0x1, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x10,
    0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
    0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
    0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44,
    0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
    0xde, 0xee, 0xef, 0xff, 0xee, 0xee, 0xee, 0xed,
    0x0, 0x0, 0xd, 0xfd, 0x0, 0x0, 0x0, 0x0,
    0x0, 0x0, 0x8f, 0xf3, 0x0, 0x6c, 0x0, 0x0,
    0x0, 0x2, 0xff, 0x90, 0x1, 0xff, 0x90, 0x0,
    0x0, 0xd, 0xfd, 0x0, 0x0, 0x5f, 0xf4, 0x0,
    0x0, 0xbf, 0xf3, 0x0, 0x0, 0xb, 0xfe, 0x10,
    0x1b, 0xff, 0xb7, 0x8a, 0xcd, 0xff, 0xff, 0xa0,
    0x2f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf4,
    0xd, 0xec, 0xba, 0x87, 0x54, 0x21, 0xb, 0xf8,
    0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x2, 0x50,

    /* U+4F1A "会" */
    0x0, 0x0, 0x0, 0x2, 0xef, 0x90, 0x0, 0x0,
    0x0, 0x0, 0x0, 0x0, 0x2e, 0xff, 0xf9, 0x0,
    0x0, 0x0, 0x0, 0x0, 0x4, 0xef, 0xd8, 0xff,
    0xb1, 0x0, 0x0, 0x0, 0x0, 0x9f, 0xfc, 0x10,
    0x5f, 0xfe, 0x50, 0x0, 0x0, 0x7e, 0xff, 0x80,
    0x0, 0x2, 0xcf, 0xfb, 0x40, 0xe, 0xff, 0xff,
    0xdd, 0xdd, 0xdd, 0xde, 0xff, 0xf6, 0x9, 0xf7,
    0x5f, 0xff, 0xff, 0xff, 0xfb, 0x2c, 0xf1, 0x1,
    0x10, 0x1, 0x11, 0x11, 0x11, 0x11, 0x0, 0x20,
    0x0, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
    0x0, 0x4, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
    0xff, 0xc0, 0x4, 0xff, 0xff, 0xff, 0xff, 0xff,
    0xff, 0xff, 0xb0, 0x0, 0x0, 0x7, 0xff, 0x40,
    0x7, 0xf5, 0x0, 0x0, 0x0, 0x0, 0x4f, 0xf8,
    0x0, 0xa, 0xff, 0x30, 0x0, 0x0, 0x4, 0xff,
    0xa2, 0x34, 0x68, 0xff, 0xe1, 0x0, 0x0, 0x3f,
    0xff, 0xff, 0xff, 0xff, 0xff, 0xfc, 0x0, 0x0,
    0xf, 0xff, 0xec, 0xb9, 0x87, 0x56, 0xfc, 0x10,
    0x0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x40,
    0x0,

    /* U+5E06 "帆" */
    0x0, 0xaf, 0x40, 0xc, 0xff, 0xff, 0xfd, 0x0,
    0x0, 0xa, 0xf4, 0x0, 0xcf, 0xff, 0xff, 0xd0,
    0x0, 0x22, 0xbf, 0x52, 0x1c, 0xf3, 0x22, 0xfd,
    0x0, 0xe, 0xff, 0xff, 0xf8, 0xcf, 0x10, 0x1f,
    0xd0, 0x0, 0xef, 0xff, 0xef, 0x8c, 0xf1, 0x1,
    0xfd, 0x0, 0xe, 0x99, 0xf2, 0xf8, 0xcf, 0x77,
    0x1f, 0xd0, 0x0, 0xe9, 0x9f, 0x2f, 0x8c, 0xff,
    0xf1, 0xfd, 0x0, 0xe, 0x99, 0xf2, 0xf8, 0xcf,
    0xbf, 0x7f, 0xd0, 0x0, 0xe9, 0x9f, 0x2f, 0x8c,
    0xf5, 0xfd, 0xfd, 0x0, 0xe, 0x99, 0xf2, 0xf8,
    0xdf, 0xe, 0xff, 0xd0, 0x0, 0xe9, 0x9f, 0x2f,
    0x8e, 0xf0, 0x65, 0xfd, 0x3, 0xe, 0x99, 0xf9,
    0xf9, 0xfe, 0x0, 0x1f, 0xd1, 0xf3, 0xe9, 0x9f,
    0xcf, 0xcf, 0xb0, 0x1, 0xfd, 0x2f, 0x36, 0x49,
    0xf5, 0x7d, 0xf7, 0x0, 0x1f, 0xd3, 0xf2, 0x0,
    0x9f, 0x26, 0xfe, 0x10, 0x0, 0xff, 0xff, 0x20,
    0x9, 0xf2, 0x3e, 0x50, 0x0, 0x8, 0xff, 0xb0,
    0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
    0x0,

    /* U+6302 "挂" */
    0x0, 0x2f, 0xf0, 0x0, 0x0, 0x3f, 0xe0, 0x0,
    0x0, 0x0, 0x2f, 0xf0, 0x0, 0x0, 0x3f, 0xe0,
    0x0, 0x0, 0x1, 0x3f, 0xf1, 0xb, 0xff, 0xff,
    0xff, 0xff, 0x50, 0x1f, 0xff, 0xff, 0x7c, 0xff,
    0xff, 0xff, 0xff, 0x50, 0x1f, 0xff, 0xff, 0x70,
    0x0, 0x4f, 0xe0, 0x0, 0x0, 0x1, 0x3f, 0xf1,
    0x12, 0x22, 0x5f, 0xe2, 0x22, 0x20, 0x0, 0x2f,
    0xf1, 0x4f, 0xff, 0xff, 0xff, 0xff, 0xf3, 0x0,
    0x2f, 0xff, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xf3,
    0x16, 0xcf, 0xff, 0x50, 0x0, 0x29, 0x80, 0x0,
    0x0, 0x6f, 0xff, 0xf4, 0x0, 0x11, 0x4f, 0xe1,
    0x11, 0x0, 0x4e, 0xaf, 0xf0, 0xc, 0xff, 0xff,
    0xff, 0xff, 0x50, 0x0, 0x2f, 0xf0, 0xc, 0xff,
    0xff, 0xff, 0xff, 0x50, 0x0, 0x2f, 0xf0, 0x0,
    0x0, 0x3f, 0xe0, 0x0, 0x0, 0x0, 0x2f, 0xf0,
    0x22, 0x22, 0x5f, 0xe2, 0x22, 0x20, 0x3, 0x5f,
    0xf1, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf6, 0xc,
    0xff, 0xe0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf5,
    0x9, 0xfe, 0x60, 0x0, 0x0, 0x0, 0x0, 0x0,
    0x0,

    /* U+65F6 "时" */
    0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xdf, 0x70,
    0xe, 0xff, 0xff, 0xf2, 0x0, 0x0, 0xd, 0xf7,
    0x0, 0xef, 0xff, 0xff, 0x20, 0x0, 0x0, 0xdf,
    0x70, 0xe, 0xf6, 0x4e, 0xf2, 0xef, 0xff, 0xff,
    0xff, 0xf2, 0xef, 0x20, 0xef, 0x2e, 0xff, 0xff,
    0xff, 0xff, 0x2e, 0xf2, 0xe, 0xf2, 0x34, 0x44,
    0x4d, 0xf9, 0x40, 0xef, 0x42, 0xef, 0x20, 0x80,
    0x0, 0xdf, 0x70, 0xe, 0xff, 0xff, 0xf2, 0xaf,
    0x90, 0xd, 0xf7, 0x0, 0xef, 0xff, 0xff, 0x22,
    0xff, 0x30, 0xdf, 0x70, 0xe, 0xf2, 0xe, 0xf2,
    0x8, 0xfc, 0xd, 0xf7, 0x0, 0xef, 0x20, 0xef,
    0x20, 0xd, 0xf3, 0xdf, 0x70, 0xe, 0xf2, 0xe,
    0xf2, 0x0, 0x42, 0xd, 0xf7, 0x0, 0xef, 0x20,
    0xef, 0x20, 0x0, 0x0, 0xdf, 0x70, 0xe, 0xff,
    0xff, 0xf2, 0x0, 0x33, 0x3e, 0xf6, 0x0, 0xef,
    0xff, 0xff, 0x20, 0xf, 0xff, 0xff, 0x40, 0x3,
    0x33, 0x33, 0x30, 0x0, 0xcf, 0xfe, 0x90, 0x0,

    /* U+6709 "有" */
    0x0, 0x0, 0x0, 0x3e, 0xc1, 0x0, 0x0, 0x0,
    0x0, 0x1, 0x22, 0x22, 0xaf, 0xd2, 0x22, 0x22,
    0x22, 0x20, 0xb, 0xff, 0xff, 0xff, 0xff, 0xff,
    0xff, 0xff, 0xf1, 0x9, 0xdd, 0xdf, 0xff, 0xdd,
    0xdd, 0xdd, 0xdd, 0xd1, 0x0, 0x0, 0x6f, 0xf3,
    0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x3, 0xff,
    0xff, 0xff, 0xff, 0xff, 0xf6, 0x0, 0x0, 0x3e,
    0xff, 0xee, 0xee, 0xee, 0xef, 0xf6, 0x0, 0x4,
    0xff, 0xfd, 0x0, 0x0, 0x0, 0xc, 0xf6, 0x0,
    0x4f, 0xff, 0xff, 0xdd, 0xdd, 0xdd, 0xdf, 0xf6,
    0x0, 0x1f, 0xc6, 0xff, 0xff, 0xff, 0xff, 0xff,
    0xf6, 0x0, 0x5, 0x5, 0xfd, 0x0, 0x0, 0x0,
    0xc, 0xf6, 0x0, 0x0, 0x5, 0xff, 0xdd, 0xdd,
    0xdd, 0xdf, 0xf6, 0x0, 0x0, 0x5, 0xff, 0xff,
    0xff, 0xff, 0xff, 0xf6, 0x0, 0x0, 0x5, 0xfd,
    0x0, 0x0, 0x0, 0xc, 0xf6, 0x0, 0x0, 0x5,
    0xfd, 0x0, 0x0, 0x10, 0xd, 0xf6, 0x0, 0x0,
    0x5, 0xfd, 0x0, 0x0, 0x7f, 0xff, 0xf4, 0x0,
    0x0, 0x4, 0xfc, 0x0, 0x0, 0x3e, 0xff, 0xa0,
    0x0,

    /* U+6CA7 "沧" */
    0x0, 0x48, 0x0, 0x0, 0x2, 0xff, 0x40, 0x0,
    0x0, 0x1, 0xef, 0xc1, 0x0, 0xb, 0xff, 0xd0,
    0x0, 0x0, 0x0, 0x6f, 0xfe, 0x20, 0x8f, 0xfe,
    0xfa, 0x0, 0x0, 0x0, 0x3, 0xec, 0x6, 0xff,
    0x84, 0xff, 0x90, 0x0, 0x4, 0x40, 0x22, 0x7f,
    0xfb, 0x0, 0x7f, 0xfb, 0x10, 0x1e, 0xfa, 0x2c,
    0xff, 0xb1, 0x0, 0x8, 0xff, 0xe4, 0x1b, 0xff,
    0xef, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf2, 0x0,
    0x6f, 0xb7, 0xaf, 0xff, 0xff, 0xff, 0xf3, 0x60,
    0x0, 0x2, 0x10, 0x4f, 0xe0, 0x0, 0x2f, 0xf0,
    0x0, 0x0, 0x4, 0x30, 0x4f, 0xe0, 0x0, 0x4f,
    0xf0, 0x0, 0x0, 0xd, 0xf7, 0x4f, 0xe0, 0xbc,
    0xef, 0xd0, 0x0, 0x0, 0x4f, 0xf2, 0x4f, 0xe0,
    0xaf, 0xff, 0x91, 0x0, 0x0, 0xbf, 0xc0, 0x4f,
    0xe0, 0x1, 0x10, 0xaf, 0x90, 0x3, 0xff, 0x60,
    0x4f, 0xf1, 0x0, 0x1, 0xdf, 0x90, 0xa, 0xfe,
    0x0, 0x2f, 0xff, 0xff, 0xff, 0xff, 0x60, 0x8,
    0xf7, 0x0, 0x8, 0xef, 0xff, 0xff, 0xea, 0x0,
    0x0, 0x0, 0x0, 0x0, 0x0, 0x11, 0x10, 0x0,
    0x0,

    /* U+6D4E "济" */
    0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0,
    0x0, 0x0, 0xa4, 0x0, 0x0, 0x5, 0xef, 0x0,
    0x0, 0x0, 0x7, 0xff, 0x70, 0x44, 0x44, 0xff,
    0x84, 0x44, 0x30, 0x0, 0xaf, 0xf9, 0xff, 0xff,
    0xff, 0xff, 0xff, 0xe0, 0x0, 0x7, 0xd2, 0xcf,
    0xfe, 0xcc, 0xcf, 0xfd, 0xb0, 0x9, 0x60, 0x0,
    0x8, 0xfe, 0x10, 0x9f, 0xd0, 0x0, 0x5f, 0xfb,
    0x10, 0x0, 0xbf, 0xeb, 0xfe, 0x20, 0x0, 0x7,
    0xff, 0xd0, 0x0, 0x1e, 0xff, 0xf5, 0x0, 0x0,
    0x0, 0x3e, 0x53, 0x7b, 0xff, 0xff, 0xff, 0xd8,
    0x41, 0x0, 0x1, 0xe, 0xff, 0xe9, 0x20, 0x7d,
    0xff, 0xf6, 0x0, 0x3e, 0x96, 0x99, 0xca, 0x0,
    0x3b, 0xc8, 0xc0, 0x0, 0x9f, 0xd0, 0x6, 0xfc,
    0x0, 0x4f, 0xd0, 0x0, 0x0, 0xef, 0x80, 0x8,
    0xfa, 0x0, 0x4f, 0xd0, 0x0, 0x5, 0xff, 0x20,
    0xd, 0xf6, 0x0, 0x4f, 0xd0, 0x0, 0xa, 0xfd,
    0x0, 0x9f, 0xf1, 0x0, 0x4f, 0xd0, 0x0, 0xf,
    0xf7, 0x1c, 0xff, 0x60, 0x0, 0x4f, 0xd0, 0x0,
    0x2, 0x81, 0xb, 0xf6, 0x0, 0x0, 0x4f, 0xd0,
    0x0, 0x0, 0x0, 0x0, 0x20, 0x0, 0x0, 0x0,
    0x0, 0x0,

    /* U+6D6A "浪" */
    0x0, 0x0, 0x0, 0x0, 0x4, 0x75, 0x0, 0x0,
    0x0, 0x1, 0xd4, 0x0, 0x0, 0x8, 0xfe, 0x0,
    0x0, 0x0, 0x9, 0xff, 0x82, 0xdd, 0xdd, 0xff,
    0xdd, 0xdd, 0x0, 0x0, 0xaf, 0xf7, 0xff, 0xff,
    0xff, 0xff, 0xff, 0x0, 0x0, 0x7, 0xa2, 0xfe,
    0x11, 0x11, 0x11, 0xff, 0x0, 0xc, 0x70, 0x2,
    0xff, 0x99, 0x99, 0x99, 0xff, 0x0, 0x6f, 0xfa,
    0x2, 0xff, 0xff, 0xff, 0xff, 0xff, 0x0, 0xa,
    0xff, 0xc2, 0xfe, 0x22, 0x22, 0x22, 0xff, 0x0,
    0x0, 0x9f, 0x92, 0xfe, 0x0, 0x0, 0x0, 0xff,
    0x0, 0x0, 0x8, 0x12, 0xff, 0xff, 0xff, 0xff,
    0xff, 0x0, 0x0, 0x3, 0x2, 0xff, 0xde, 0xfe,
    0xdd, 0xde, 0x0, 0x0, 0x4f, 0xd2, 0xfe, 0x4,
    0xfd, 0x0, 0x7f, 0x60, 0x0, 0x9f, 0xb2, 0xfe,
    0x0, 0xcf, 0x9c, 0xff, 0x70, 0x0, 0xef, 0x62,
    0xfe, 0x0, 0x3f, 0xff, 0xb2, 0x0, 0x5, 0xff,
    0x12, 0xfe, 0x4a, 0x76, 0xff, 0xa1, 0x0, 0xb,
    0xfb, 0x6, 0xff, 0xff, 0xa0, 0x6f, 0xff, 0xb1,
    0xe, 0xf5, 0x6, 0xff, 0xe8, 0x20, 0x2, 0xcf,
    0xd0, 0x0, 0x50, 0x0, 0xa4, 0x0, 0x0, 0x0,
    0x3, 0x30,

    /* U+6D77 "海" */
    0x0, 0x0, 0x0, 0x0, 0x10, 0x0, 0x0, 0x0,
    0x0, 0x1, 0xc3, 0x0, 0x7, 0xfb, 0x0, 0x0,
    0x0, 0x0, 0x9, 0xff, 0x60, 0x1f, 0xff, 0xff,
    0xff, 0xff, 0xf0, 0x0, 0x9f, 0xf4, 0xaf, 0xff,
    0xff, 0xff, 0xff, 0xf0, 0x0, 0x6, 0xa6, 0xff,
    0x30, 0x0, 0x0, 0x0, 0x0, 0x8, 0x60, 0xe,
    0xff, 0xee, 0xee, 0xee, 0xee, 0x40, 0x3f, 0xfa,
    0x4, 0xff, 0xff, 0xff, 0xff, 0xff, 0x30, 0x6,
    0xff, 0xc0, 0x9f, 0x62, 0xfc, 0x10, 0xcf, 0x30,
    0x0, 0x3e, 0x50, 0xbf, 0x50, 0x8f, 0x80, 0xdf,
    0x20, 0x0, 0x1, 0x1d, 0xff, 0xed, 0xdf, 0xdd,
    0xff, 0xe6, 0x0, 0x35, 0x2f, 0xff, 0xff, 0xff,
    0xff, 0xff, 0xf7, 0x0, 0x9f, 0x80, 0xff, 0x8,
    0xf9, 0x0, 0xff, 0x0, 0x0, 0xdf, 0x42, 0xfd,
    0x1, 0xcf, 0x41, 0xff, 0x0, 0x2, 0xff, 0x4,
    0xff, 0xff, 0xff, 0xff, 0xff, 0xf3, 0x6, 0xfb,
    0x5, 0xee, 0xee, 0xee, 0xef, 0xff, 0xe3, 0xb,
    0xf7, 0x0, 0x0, 0x0, 0x10, 0x8, 0xfa, 0x0,
    0xf, 0xf3, 0x0, 0x0, 0x0, 0xee, 0xdf, 0xf7,
    0x0, 0x5, 0xa0, 0x0, 0x0, 0x0, 0xae, 0xff,
    0xb0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
    0x0, 0x0, 0x0,

    /* U+76F4 "直" */
    0x0, 0x0, 0x0, 0x1, 0xff, 0x10, 0x0, 0x0,
    0x0, 0xa, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
    0xff, 0xa0, 0x8, 0xdd, 0xdd, 0xdd, 0xff, 0xdd,
    0xdd, 0xdd, 0x80, 0x0, 0x2, 0x22, 0x23, 0xff,
    0x32, 0x22, 0x20, 0x0, 0x0, 0x2f, 0xff, 0xff,
    0xff, 0xff, 0xff, 0xf3, 0x0, 0x0, 0x2f, 0xf9,
    0x99, 0x99, 0x99, 0x9f, 0xf3, 0x0, 0x0, 0x2f,
    0xf7, 0x77, 0x77, 0x77, 0x7f, 0xf3, 0x0, 0x0,
    0x2f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf3, 0x0,
    0x0, 0x2f, 0xf0, 0x0, 0x0, 0x0, 0xf, 0xf3,
    0x0, 0x0, 0x2f, 0xff, 0xff, 0xff, 0xff, 0xff,
    0xf3, 0x0, 0x0, 0x2f, 0xf8, 0x88, 0x88, 0x88,
    0x8f, 0xf3, 0x0, 0x0, 0x2f, 0xf8, 0x88, 0x88,
    0x88, 0x8f, 0xf3, 0x0, 0x0, 0x2f, 0xff, 0xff,
    0xff, 0xff, 0xff, 0xf3, 0x0, 0x0, 0x2f, 0xf0,
    0x0, 0x0, 0x0, 0xf, 0xf3, 0x0, 0x2c, 0xdf,
    0xfc, 0xcc, 0xcc, 0xcc, 0xcf, 0xfd, 0xc2, 0x2f,
    0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf2,

    /* U+7834 "破" */
    0x0, 0x0, 0x0, 0x0, 0x0, 0xb, 0xf4, 0x0,
    0x0, 0xd, 0xee, 0xee, 0xb0, 0x11, 0x1c, 0xf4,
    0x11, 0x10, 0xf, 0xff, 0xff, 0xd7, 0xff, 0xff,
    0xff, 0xff, 0xf2, 0x1, 0x5f, 0xb1, 0x17, 0xff,
    0xff, 0xff, 0xff, 0xf1, 0x0, 0x8f, 0x70, 0x7,
    0xf7, 0xb, 0xf4, 0x3f, 0xe0, 0x0, 0xdf, 0x30,
    0x7, 0xf7, 0xb, 0xf4, 0x4c, 0x90, 0x2, 0xff,
    0xdd, 0x67, 0xfa, 0x4c, 0xf7, 0x44, 0x10, 0xb,
    0xff, 0xff, 0x87, 0xff, 0xff, 0xff, 0xff, 0x60,
    0x3f, 0xfc, 0x7f, 0x87, 0xff, 0xfd, 0xdd, 0xff,
    0x60, 0x8f, 0xfa, 0x3f, 0x88, 0xff, 0xf3, 0x2,
    0xff, 0x10, 0x3d, 0xfa, 0x3f, 0x89, 0xfb, 0xfb,
    0xa, 0xfa, 0x0, 0x3, 0xfa, 0x3f, 0x8b, 0xf4,
    0xdf, 0xaf, 0xf2, 0x0, 0x0, 0xfa, 0x4f, 0x8e,
    0xf1, 0x3f, 0xff, 0x80, 0x0, 0x0, 0xff, 0xff,
    0xaf, 0xd0, 0x6f, 0xff, 0xb2, 0x0, 0x0, 0xee,
    0xee, 0xff, 0xbb, 0xff, 0xbf, 0xff, 0xa2, 0x0,
    0x0, 0x1, 0xff, 0xbf, 0xf6, 0x2, 0xcf, 0xf2,
    0x0, 0x0, 0x0, 0x37, 0x1a, 0x10, 0x0, 0x4,
    0x60,

    /* U+957F "长" */
    0x0, 0xb, 0xf8, 0x0, 0x0, 0x0, 0x5, 0x70,
    0x0, 0x0, 0xb, 0xf8, 0x0, 0x0, 0x3, 0xcf,
    0xf2, 0x0, 0x0, 0xb, 0xf8, 0x0, 0x4, 0xaf,
    0xff, 0xd3, 0x0, 0x0, 0xb, 0xf8, 0x6, 0xdf,
    0xff, 0xe6, 0x0, 0x0, 0x0, 0xb, 0xf8, 0x3f,
    0xff, 0xd6, 0x0, 0x0, 0x0, 0x0, 0xb, 0xf8,
    0xc, 0xb4, 0x0, 0x0, 0x0, 0x0, 0x5, 0x5c,
    0xfa, 0x55, 0x55, 0x55, 0x55, 0x55, 0x40, 0x1f,
    0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0,
    0x1e, 0xef, 0xff, 0xee, 0xff, 0xee, 0xee, 0xee,
    0xd0, 0x0, 0xb, 0xf8, 0x0, 0xaf, 0xd0, 0x0,
    0x0, 0x0, 0x0, 0xb, 0xf8, 0x0, 0x2f, 0xf8,
    0x0, 0x0, 0x0, 0x0, 0xb, 0xf8, 0x0, 0x7,
    0xff, 0x80, 0x0, 0x0, 0x0, 0xb, 0xf8, 0x0,
    0x35, 0x9f, 0xfa, 0x10, 0x0, 0x0, 0xb, 0xf9,
    0x7d, 0xf9, 0x9, 0xff, 0xf9, 0x20, 0x0, 0x2e,
    0xff, 0xff, 0xf8, 0x0, 0x6e, 0xff, 0xf1, 0x0,
    0xe, 0xff, 0xd7, 0x10, 0x0, 0x1, 0x8f, 0x80,
    0x0, 0x7, 0xa3, 0x0, 0x0, 0x0, 0x0, 0x0,
    0x0,

    /* U+98CE "风" */
    0x0, 0xef, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe0,
    0x0, 0x0, 0xef, 0xff, 0xff, 0xff, 0xff, 0xff,
    0xe0, 0x0, 0x0, 0xef, 0x52, 0x22, 0x22, 0x22,
    0x5f, 0xe0, 0x0, 0x0, 0xef, 0x33, 0x30, 0x0,
    0xb7, 0x4f, 0xe0, 0x0, 0x0, 0xef, 0x8f, 0xd0,
    0x3, 0xff, 0x6f, 0xe0, 0x0, 0x0, 0xef, 0x4e,
    0xf9, 0xc, 0xf9, 0x4f, 0xe0, 0x0, 0x0, 0xef,
    0x34, 0xff, 0x8f, 0xf2, 0x4f, 0xe0, 0x0, 0x0,
    0xef, 0x30, 0x9f, 0xff, 0x90, 0x4f, 0xe0, 0x0,
    0x0, 0xef, 0x30, 0xe, 0xff, 0x10, 0x4f, 0xe0,
    0x0, 0x0, 0xff, 0x20, 0x3f, 0xff, 0x40, 0x4f,
    0xe0, 0x0, 0x0, 0xff, 0x10, 0xdf, 0xff, 0xd0,
    0x3f, 0xe0, 0x0, 0x2, 0xff, 0xa, 0xff, 0x4f,
    0xf9, 0x3f, 0xe2, 0xd3, 0x6, 0xfd, 0x7f, 0xf5,
    0x7, 0xff, 0x5f, 0xf4, 0xf4, 0xb, 0xfb, 0xff,
    0x90, 0x0, 0xdf, 0x9f, 0xfa, 0xf1, 0x2f, 0xf4,
    0x5b, 0x0, 0x0, 0x37, 0xc, 0xff, 0xe0, 0x8f,
    0xe0, 0x0, 0x0, 0x0, 0x0, 0x8, 0xff, 0x90,
    0x7, 0x60, 0x0, 0x0, 0x0, 0x0, 0x1, 0xcd,
    0x10
};


/*---------------------
 *  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 = 124, .box_w = 8, .box_h = 14, .ofs_x = 0, .ofs_y = 0},
    {.bitmap_index = 56, .adv_w = 174, .box_w = 9, .box_h = 10, .ofs_x = 1, .ofs_y = 0},
    {.bitmap_index = 101, .adv_w = 288, .box_w = 16, .box_h = 17, .ofs_x = 1, .ofs_y = -2},
    {.bitmap_index = 237, .adv_w = 288, .box_w = 18, .box_h = 17, .ofs_x = 0, .ofs_y = -2},
    {.bitmap_index = 390, .adv_w = 288, .box_w = 17, .box_h = 17, .ofs_x = 1, .ofs_y = -2},
    {.bitmap_index = 535, .adv_w = 288, .box_w = 18, .box_h = 17, .ofs_x = 0, .ofs_y = -2},
    {.bitmap_index = 688, .adv_w = 288, .box_w = 17, .box_h = 16, .ofs_x = 1, .ofs_y = -1},
    {.bitmap_index = 824, .adv_w = 288, .box_w = 18, .box_h = 17, .ofs_x = 0, .ofs_y = -2},
    {.bitmap_index = 977, .adv_w = 288, .box_w = 18, .box_h = 17, .ofs_x = 0, .ofs_y = -2},
    {.bitmap_index = 1130, .adv_w = 288, .box_w = 18, .box_h = 18, .ofs_x = 0, .ofs_y = -2},
    {.bitmap_index = 1292, .adv_w = 288, .box_w = 18, .box_h = 18, .ofs_x = 0, .ofs_y = -2},
    {.bitmap_index = 1454, .adv_w = 288, .box_w = 18, .box_h = 19, .ofs_x = 0, .ofs_y = -3},
    {.bitmap_index = 1625, .adv_w = 288, .box_w = 18, .box_h = 16, .ofs_x = 0, .ofs_y = -1},
    {.bitmap_index = 1769, .adv_w = 288, .box_w = 18, .box_h = 17, .ofs_x = 0, .ofs_y = -2},
    {.bitmap_index = 1922, .adv_w = 288, .box_w = 18, .box_h = 17, .ofs_x = 0, .ofs_y = -2},
    {.bitmap_index = 2075, .adv_w = 288, .box_w = 18, .box_h = 17, .ofs_x = 0, .ofs_y = -2}
};

/*---------------------
 *  CHARACTER MAPPING
 *--------------------*/

static const uint16_t unicode_list_0[] = {
    0x0, 0x12, 0x4e35, 0x4ebe, 0x5daa, 0x62a6, 0x659a, 0x66ad,
    0x6c4b, 0x6cf2, 0x6d0e, 0x6d1b, 0x7698, 0x77d8, 0x9523, 0x9872
};

/*Collect the unicode lists and glyph_id offsets*/
static const lv_font_fmt_txt_cmap_t cmaps[] =
{
    {
        .range_start = 92, .range_length = 39027, .glyph_id_start = 1,
        .unicode_list = unicode_list_0, .glyph_id_ofs_list = NULL, .list_length = 16, .type = LV_FONT_FMT_TXT_CMAP_SPARSE_TINY
    }
};

/*-----------------
 *    KERNING
 *----------------*/


 /*Pair left and right glyphs for kerning*/
static const uint8_t kern_pair_glyph_ids[] =
{
    1, 1,
    2, 1
};

/* 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[] =
{
    -31, -25
};

/*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 = 2,
    .glyph_ids_size = 0
};

/*--------------------
 *  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 = &kern_pairs,
    .kern_scale = 16,
    .cmap_num = 1,
    .bpp = 4,
    .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 myFont = {
 #else
 lv_font_t myFont = {
 #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 = 19,          /*The maximum line height required by the font*/
     .base_line = 3,             /*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)
     .underline_position = -1,
     .underline_thickness = 1,
 #endif
     .dsc = &font_dsc           /*The custom font data. Will be accessed by `get_glyph_bitmap/dsc` */
 };



 #endif /*#if MYFONT*/


  • 声明字体
LV_FONT_DECLARE(myFont)
  • 创建label并居中显示
    const char* str1 = "长风破浪会有时\n直挂云帆济沧海";
    lv_obj_t* label_dl_1 = lv_label_create(lv_scr_act(), NULL);
    lv_label_set_text(label_dl_1, str1);
    lv_obj_center(label_dl_1);
  • 设置字体
    lv_obj_set_style_text_font(label_dl_1, &myFont, 0);
    lv_obj_set_style_text_color(label_dl_1, lv_color_make(0xff, 0x00, 0x00), 0);
  • 配置编译运行字体为utf-8
#pragma execution_character_set("utf-8") 
  • 运行效果图
    在这里插入图片描述

版权声明:本文为CSDN博主「仙剑情缘」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/mygod2008ok/article/details/119845883

生成海报
点赞 0

仙剑情缘

我还没有学会写个人说明!

暂无评论

发表评论

相关推荐

干货|手把手教你写单片机的结构体

摘要:听说还有好多学单片机的小伙伴不会用结构体?指针和结构体是学单片机必须要掌握的,如果你C语言掌握的不牢,单片机根本学不到精髓,只能完成一些低级的项目。看得懂结构体并且能够

LVGL V8之显示中文

使用在线工具转换字体 在线转换工具 转换“长风破浪会有时\n直挂云帆济沧海” 转换好的文件内容 /**********************************************************************