mirror of
https://github.com/lvgl/lvgl.git
synced 2025-01-21 06:53:01 +08:00
font: update kern space format
This commit is contained in:
parent
cc97e114c2
commit
469157ebd9
@ -83,7 +83,7 @@ static const uint8_t lv_font_dejavu_20_glyph_bitmap[] = {
|
||||
|
||||
|
||||
static const lv_font_kern_t kern_0031[] = {
|
||||
{.next_unicode = 0x0033, .space = 3 << 4},
|
||||
{.next_unicode = 0x0033, .space = LV_FONT_SET_WIDTH(8, 0), .space_sign = LV_FONT_KERN_POSITIVE},
|
||||
{.next_unicode = 0x0000} /*Trailing*/
|
||||
};
|
||||
|
||||
|
@ -42,7 +42,7 @@ static int32_t lv_font_codeCompare(const void * pRef, const void * pElement);
|
||||
**********************/
|
||||
|
||||
/**
|
||||
* Initialize the fonts
|
||||
* Initialize the font module
|
||||
*/
|
||||
void lv_font_init(void)
|
||||
{
|
||||
@ -143,7 +143,11 @@ uint8_t lv_font_get_glyph_width(const lv_font_t * font, uint32_t letter, uint32_
|
||||
uint32_t i;
|
||||
for(i = 0; dsc.kern_table[i].next_unicode != 0; i++) {
|
||||
if((uint32_t)dsc.kern_table[i].next_unicode == letter_next) {
|
||||
if(dsc.kern_table[i].space_sign == LV_FONT_KERN_POSITIVE) {
|
||||
w += dsc.kern_table[i].space;
|
||||
} else {
|
||||
w -= dsc.kern_table[i].space;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -41,8 +41,10 @@ extern "C" {
|
||||
|
||||
/*One element of a kerning table*/
|
||||
typedef struct {
|
||||
int32_t next_unicode :23;
|
||||
int32_t space :9; /*5 integer, 4 fractional*/
|
||||
uint32_t next_unicode :23;
|
||||
|
||||
uint32_t space :8; /*5 integer, 4 fractional*/
|
||||
uint32_t space_sign :1; /*0: space positive; 1: space negative*/
|
||||
}lv_font_kern_t;
|
||||
|
||||
/*Describe the properties of a glyph*/
|
||||
@ -202,6 +204,9 @@ bool lv_font_get_glyph_dsc_plain(const lv_font_t * font, lv_font_glyph_dsc_t * d
|
||||
#define LV_FONT_GET_WIDTH_INT(_w) (_w >> LV_FONT_WIDTH_FRACT_DIGIT)
|
||||
#define LV_FONT_GET_WIDTH_FRACT(_w) (_w & ((1 << LV_FONT_WIDTH_FRACT_DIGIT) -1))
|
||||
|
||||
#define LV_FONT_KERN_POSITIVE 0
|
||||
#define LV_FONT_KERN_NEGATIVE 1
|
||||
|
||||
|
||||
/**********************
|
||||
* ADD BUILT IN FONTS
|
||||
|
Loading…
x
Reference in New Issue
Block a user