mute_symbol.c
/*******************************************************************************
* Size: 16 px
* Bpp: 4
* Opts: --bpp 4 --size 16 --no-compress --font FontAwesome5-Solid+Brands+Regular.woff --range 63145 --format lvgl -o mute_symbol.c
******************************************************************************/
#ifdef LV_LVGL_H_INCLUDE_SIMPLE
#include "lvgl.h"
#else
#include "lvgl/lvgl.h"
#endif
#ifndef MUTE_SYMBOL
#define MUTE_SYMBOL 1
#endif
#if MUTE_SYMBOL
/*-----------------
* BITMAPS
*----------------*/
/*Store the image of the glyphs*/
static LV_ATTRIBUTE_LARGE_CONST const uint8_t glyph_bitmap[] = {
/* U+F6A9 "" */
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x8, 0xd0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x8, 0xff, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x8, 0xff, 0xf0, 0x0, 0x0,
0x0, 0x0, 0xdf, 0xff, 0xff, 0xff, 0x0, 0x7c,
0x11, 0xc7, 0xf, 0xff, 0xff, 0xff, 0xf0, 0xc,
0xfd, 0xdf, 0xc0, 0xff, 0xff, 0xff, 0xff, 0x0,
0x1d, 0xff, 0xd1, 0xf, 0xff, 0xff, 0xff, 0xf0,
0x1, 0xdf, 0xfd, 0x10, 0xff, 0xff, 0xff, 0xff,
0x0, 0xcf, 0xdd, 0xfc, 0xd, 0xff, 0xff, 0xff,
0xf0, 0x7, 0xc1, 0x1c, 0x70, 0x0, 0x0, 0x9f,
0xff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x9f, 0xf0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x0, 0x8d, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0
};
/*---------------------
* 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 = 256, .box_w = 17, .box_h = 14, .ofs_x = 0, .ofs_y = -1}
};
/*---------------------
* CHARACTER MAPPING
*--------------------*/
/*Collect the unicode lists and glyph_id offsets*/
static const lv_font_fmt_txt_cmap_t cmaps[] =
{
{
.range_start = 63145, .range_length = 1, .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 LVGL_VERSION_MAJOR == 8
/*Store all the custom data of the font*/
static lv_font_fmt_txt_glyph_cache_t cache;
#endif
#if LVGL_VERSION_MAJOR >= 8
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 = 4,
.kern_classes = 0,
.bitmap_format = 0,
#if LVGL_VERSION_MAJOR == 8
.cache = &cache
#endif
};
/*-----------------
* PUBLIC FONT
*----------------*/
/*Initialize a public general font descriptor*/
#if LVGL_VERSION_MAJOR >= 8
const lv_font_t mute_symbol = {
#else
lv_font_t mute_symbol = {
#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 = 14, /*The maximum line height required by the font*/
.base_line = 1, /*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 = -6,
.underline_thickness = 1,
#endif
.dsc = &font_dsc, /*The custom font data. Will be accessed by `get_glyph_bitmap/dsc` */
#if LV_VERSION_CHECK(8, 2, 0) || LVGL_VERSION_MAJOR >= 9
.fallback = NULL,
#endif
.user_data = NULL,
};
#endif /*#if MUTE_SYMBOL*/
ui.h
LV_FONT_DECLARE(mute_symbol);
#define LV_SYMBOL_MUTED "\xEF\x9A\xA9"
MainScreen.c
USAGE
ui_icon_mute = lv_label_create(btn);
lv_obj_set_width(ui_icon_mute, LV_SIZE_CONTENT);
lv_obj_set_height(ui_icon_mute, LV_SIZE_CONTENT);
lv_obj_set_align(ui_icon_mute, LV_ALIGN_CENTER);
lv_obj_set_style_text_color(ui_icon_mute, lv_color_hex(0x000000), LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_text_opa(ui_icon_mute, 255, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_text_align(ui_icon_mute, LV_TEXT_ALIGN_CENTER, LV_PART_MAIN | LV_STATE_DEFAULT);
static lv_style_t style;
lv_style_init(&style);
lv_style_set_text_font(&style, &mute_symbol);
lv_obj_add_style(ui_icon_mute, &style, LV_PART_MAIN);
lv_label_set_text(ui_icon_mute, LV_SYMBOL_MUTED);