mirror of
https://github.com/lvgl/lvgl.git
synced 2025-01-21 06:53:01 +08:00
font: remove monospace
This commit is contained in:
parent
b623eabb0a
commit
cc48391333
@ -83,11 +83,11 @@ static const uint8_t lv_font_dejavu_20_glyph_bitmap[] = {
|
||||
|
||||
/*Store the glyph descriptions*/
|
||||
static const lv_font_glyph_dsc_t lv_font_dejavu_20_glyph_dsc[] = {
|
||||
{.adv_w = 6, .adv_w_fract = 0, .box_w = 6, .box_h = 0, .ofs_x = 0, .ofs_y = 0, .bitmap_index = 0}, /*Unicode: U+0020 ( )*/
|
||||
{.adv_w = 8, .adv_w_fract = 0, .box_w = 8, .box_h = 13,.ofs_x = 0, .ofs_y = 3, .bitmap_index = 0}, /*Unicode: U+0031 (1)*/
|
||||
{.adv_w = 9, .adv_w_fract = 0, .box_w = 9, .box_h = 13,.ofs_x = 0, .ofs_y = 3, .bitmap_index = 13}, /*Unicode: U+0033 (3)*/
|
||||
{.adv_w = 12, .adv_w_fract = 0, .box_w = 12,.box_h = 13,.ofs_x = 0, .ofs_y = 3, .bitmap_index = 39}, /*Unicode: U+0041 (A)*/
|
||||
{.adv_w = 8, .adv_w_fract = 0, .box_w = 8, .box_h = 10,.ofs_x = 0, .ofs_y = 6, .bitmap_index = 65}, /*Unicode: U+0061 (a)*/
|
||||
{.adv_w = LV_FONT_SET_ADV_W(6, 0), .box_w = 6, .box_h = 0, .ofs_x = 0, .ofs_y = 0, .bitmap_index = 0}, /*Unicode: U+0020 ( )*/
|
||||
{.adv_w = LV_FONT_SET_ADV_W(8, 0), .box_w = 8, .box_h = 13,.ofs_x = 0, .ofs_y = 3, .bitmap_index = 0}, /*Unicode: U+0031 (1)*/
|
||||
{.adv_w = LV_FONT_SET_ADV_W(9, 0), .box_w = 9, .box_h = 13,.ofs_x = 0, .ofs_y = 3, .bitmap_index = 13}, /*Unicode: U+0033 (3)*/
|
||||
{.adv_w = LV_FONT_SET_ADV_W(12, 0), .box_w = 12,.box_h = 13,.ofs_x = 0, .ofs_y = 3, .bitmap_index = 39}, /*Unicode: U+0041 (A)*/
|
||||
{.adv_w = LV_FONT_SET_ADV_W(8, 0), .box_w = 8, .box_h = 10,.ofs_x = 0, .ofs_y = 6, .bitmap_index = 65}, /*Unicode: U+0061 (a)*/
|
||||
};
|
||||
|
||||
static const uint16_t lv_font_dejavu_20_unicode_list[] = {
|
||||
@ -113,7 +113,6 @@ lv_font_t lv_font_dejavu_20 = {
|
||||
.get_glyph_dsc = lv_font_get_glyph_dsc_plain, /*Function pointer to get glyph's width*/
|
||||
.bpp = 1, /*Bit per pixel*/
|
||||
.line_height = 20, /*Font height in pixels*/
|
||||
.monospace = 0,
|
||||
.next_page = NULL, /*Pointer to a font extension*/
|
||||
};
|
||||
|
||||
|
@ -82,32 +82,6 @@ void lv_font_remove(lv_font_t * child, lv_font_t * parent)
|
||||
parent->next_page = child->next_page;
|
||||
}
|
||||
|
||||
/**
|
||||
* Tells if font which contains `letter` is monospace or not
|
||||
* @param font_p point to font
|
||||
* @param letter an UNICODE character code
|
||||
* @return true: the letter is monospace; false not monospace
|
||||
*/
|
||||
bool lv_font_is_monospace(const lv_font_t * font_p, uint32_t letter)
|
||||
{
|
||||
// const lv_font_t * font_i = font_p;
|
||||
// int16_t w;
|
||||
// while(font_i != NULL) {
|
||||
// w = font_i->get_width(font_i, letter);
|
||||
// if(w >= 0) {
|
||||
// /*Glyph found*/
|
||||
// if(font_i->monospace) return true;
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// font_i = font_i->next_page;
|
||||
// }
|
||||
//
|
||||
// return 0;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return with the bitmap of a font.
|
||||
* @param font_p pointer to a font
|
||||
|
@ -28,6 +28,8 @@ extern "C" {
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
/*Number of fractional digits in the advanced width (`adv_w`) field of `lv_font_glyph_dsc_t`*/
|
||||
#define LV_FONT_ADV_W_FRACT_DIGIT 4
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
@ -36,9 +38,7 @@ extern "C" {
|
||||
typedef struct
|
||||
{
|
||||
uint32_t bitmap_index : 20; /* Start index of the bitmap. A font can be max 1 MB. */
|
||||
uint32_t adv_w :8; /*The glyph need this space. Draw the next glyph after this width */
|
||||
uint32_t adv_w_fract :4; /*Fractional part of `advance_width` in 1/16 unit*/
|
||||
|
||||
uint32_t adv_w :12; /*The glyph needs this space. Draw the next glyph after this width. 8 bit integer, 4 bit fractional */
|
||||
uint8_t box_w; /*Width of the glyph's bounding box*/
|
||||
uint8_t box_h; /*Height of the glyph's bounding box*/
|
||||
uint8_t ofs_x; /*x offset of the bounding box*/
|
||||
@ -69,7 +69,6 @@ typedef struct _lv_font_struct
|
||||
uint8_t size; /*The original size*/
|
||||
uint8_t line_height; /*The real line height where any text fits*/
|
||||
uint8_t base_line; /*Base line measured from the top of the line*/
|
||||
uint8_t monospace; /*Overwrite the glyph's width (0: normal width)*/
|
||||
uint8_t bpp; /*Bit per pixel: 1, 2, 4 or 8*/
|
||||
|
||||
void * dsc; /*Store implementation specific data here*/
|
||||
@ -183,6 +182,11 @@ const lv_font_glyph_dsc_t * lv_font_get_glyph_dsc_plain(const lv_font_t * font,
|
||||
|
||||
#define LV_FONT_DECLARE(font_name) extern lv_font_t font_name;
|
||||
|
||||
#define LV_FONT_SET_ADV_W(_integer, _fract) ((_integer << LV_FONT_ADV_W_FRACT_DIGIT) + _fract)
|
||||
#define LV_FONT_GET_ADV_W_INT(_adv_w) (_adw_v >> LV_FONT_ADV_W_FRACT_DIGIT)
|
||||
#define LV_FONT_GET_ADV_W_FRACT(_adv_w) (_adw_v & ((1 << LV_FONT_ADV_W_FRACT_DIGIT) -1))
|
||||
|
||||
|
||||
/**********************
|
||||
* ADD BUILT IN FONTS
|
||||
**********************/
|
||||
|
Loading…
x
Reference in New Issue
Block a user