1
0
mirror of https://github.com/lvgl/lvgl.git synced 2025-01-14 06:42:58 +08:00

lv_draw_label bugfix (old rounding from LV_FONT_ANTIALIAS)

This commit is contained in:
Gabor Kiss-Vamosi 2018-02-23 15:19:39 +01:00
parent a11957d0b4
commit c4503cb8f8
2 changed files with 20 additions and 23 deletions

View File

@ -362,10 +362,6 @@ void lv_draw_label(const lv_area_t * coords,const lv_area_t * mask, const lv_sty
letter_w = lv_font_get_width(font, letter);
pos.x += letter_w + style->text.letter_space;
/* Round error occurs in x position
* When odd widths are scaled down the last 1 is lost. So the letters seems shorter.
* Now calculate according to it to be consequent */
if(letter_w & 0x01) pos.x--;
}
/*Go to next line*/
line_start = line_end;

View File

@ -139,77 +139,78 @@ const int16_t lv_font_get_width_sparse(const lv_font_t * font, uint32_t unicode_
/**********************
* MACROS
**********************/
#define LV_FONT_DECLARE(font_name) extern lv_font_t font_name;
/***********************
* FONT DECLARATION INCLUDES
***********************/
/******************************
* FONT DECLARATION INCLUDES
*****************************/
/*10 px */
#if USE_LV_FONT_DEJAVU_10
extern lv_font_t lv_font_dejavu_10;
LV_FONT_DECLARE(lv_font_dejavu_10);
#endif
#if USE_LV_FONT_DEJAVU_10_LATIN_SUP
extern lv_font_t lv_font_dejavu_10_latin_sup;
LV_FONT_DECLARE(lv_font_dejavu_10_latin_sup);
#endif
#if USE_LV_FONT_DEJAVU_10_CYRILLIC
extern lv_font_t lv_font_dejavu_10_cyrillic;
LV_FONT_DECLARE(lv_font_dejavu_10_cyrillic);
#endif
#if USE_LV_FONT_SYMBOL_10
extern lv_font_t lv_font_symbol_10;
LV_FONT_DECLARE(lv_font_symbol_10);
#endif
/*20 px */
#if USE_LV_FONT_DEJAVU_20
extern lv_font_t lv_font_dejavu_20;
LV_FONT_DECLARE(lv_font_dejavu_20);
#endif
#if USE_LV_FONT_DEJAVU_20_LATIN_SUP
extern lv_font_t lv_font_dejavu_20_latin_sup;
LV_FONT_DECLARE(lv_font_dejavu_20_latin_sup);
#endif
#if USE_LV_FONT_DEJAVU_20_CYRILLIC
extern lv_font_t lv_font_dejavu_20_cyrillic;
LV_FONT_DECLARE(lv_font_dejavu_20_cyrillic);
#endif
#if USE_LV_FONT_SYMBOL_20
extern lv_font_t lv_font_symbol_20;
LV_FONT_DECLARE(lv_font_symbol_20);
#endif
/*30 px */
#if USE_LV_FONT_DEJAVU_30
extern lv_font_t lv_font_dejavu_30;
LV_FONT_DECLARE(lv_font_dejavu_30);
#endif
#if USE_LV_FONT_DEJAVU_30_LATIN_SUP
extern lv_font_t lv_font_dejavu_30_latin_sup;
LV_FONT_DECLARE(lv_font_dejavu_30_latin_sup);
#endif
#if USE_LV_FONT_DEJAVU_30_CYRILLIC
extern lv_font_t lv_font_dejavu_30_cyrillic;
LV_FONT_DECLARE(lv_font_dejavu_30_cyrillic);
#endif
#if USE_LV_FONT_SYMBOL_30
extern lv_font_t lv_font_symbol_30;
LV_FONT_DECLARE(lv_font_symbol_30);
#endif
/*40 px */
#if USE_LV_FONT_DEJAVU_40
extern lv_font_t lv_font_dejavu_40;
LV_FONT_DECLARE(lv_font_dejavu_40);
#endif
#if USE_LV_FONT_DEJAVU_40_LATIN_SUP
extern lv_font_t lv_font_dejavu_40_latin_sup;
LV_FONT_DECLARE(lv_font_dejavu_40_latin_sup);
#endif
#if USE_LV_FONT_DEJAVU_40_CYRILLIC
extern lv_font_t lv_font_dejavu_40_cyrillic;
LV_FONT_DECLARE(lv_font_dejavu_40_cyrillic);
#endif
#if USE_LV_FONT_SYMBOL_40
extern lv_font_t lv_font_symbol_40;
LV_FONT_DECLARE(lv_font_symbol_40);
#endif
#ifdef __cplusplus