BigW Consortium Gitlab

Commit ebfe8fbf by Gabor Kiss-Vamosi

update to the new font desciption

parent 1bbe6e10
......@@ -288,7 +288,7 @@ void lv_draw_label(const area_t * cords_p,const area_t * mask_p, const lv_style_
if((flag & TXT_FLAG_RECOLOR) != 0) {
if(letter == TXT_RECOLOR_CMD) {
if(cmd_state == CMD_STATE_WAIT) { /*Start char*/
par_start = i + txt_utf8_size(&txt[i]);
par_start = i + txt_utf8_size(txt[i]);
cmd_state = CMD_STATE_PAR;
continue;
} else if(cmd_state == CMD_STATE_PAR) { /*Other start char in parameter escaped cmd. char */
......
......@@ -95,6 +95,7 @@ void lv_rletter(const point_t * pos_p, const area_t * mask_p,
color_t color, opa_t opa)
{
uint8_t w = font_get_width(font_p, letter);
const uint8_t * bitmap_p = font_get_bitmap(font_p, letter);
uint8_t col, col_sub, row;
......@@ -110,15 +111,14 @@ void lv_rletter(const point_t * pos_p, const area_t * mask_p,
col_sub = 8;
}
}
/*Correction if the letter is short*/
bitmap_p += font_p->width_byte - ((w >> 3) + 1);
/*Go to the next row*/
bitmap_p ++;
}
#else
uint8_t width_byte = w >> 3; /*Width in bytes (e.g. w = 11 -> 2 bytes wide)*/
if(w & 0x7) width_byte++;
const uint8_t * map1_p = bitmap_p;
const uint8_t * map2_p = bitmap_p + font_p->width_byte;
const uint8_t * map2_p = bitmap_p + width_byte;
uint8_t px_cnt;
uint8_t col_byte_cnt;
for(row = 0; row < (font_p->height_row >> 1); row ++) {
......@@ -152,10 +152,10 @@ void lv_rletter(const point_t * pos_p, const area_t * mask_p,
}
}
map1_p += font_p->width_byte;
map2_p += font_p->width_byte;
map1_p += font_p->width_byte - col_byte_cnt;
map2_p += font_p->width_byte - col_byte_cnt;
map1_p += width_byte;
map2_p += width_byte;
map1_p += width_byte - col_byte_cnt;
map2_p += width_byte - col_byte_cnt;
}
#endif
}
......
......@@ -170,6 +170,8 @@ void lv_vletter(const point_t * pos_p, const area_t * mask_p,
cord_t col, row;
uint8_t col_bit;
uint8_t col_byte_cnt;
uint8_t width_byte = letter_w >> 3; /*Width in bytes (e.g. w = 11 -> 2 bytes wide)*/
if(letter_w & 0x7) width_byte++;
/* Calculate the col/row start/end on the map
* If font anti alaiassing is enabled use the reduced letter sizes*/
......@@ -186,13 +188,13 @@ void lv_vletter(const point_t * pos_p, const area_t * mask_p,
vdb_buf_tmp += (row_start * vdb_width) + col_start;
/*Move on the map too*/
map_p += ((row_start << FONT_ANTIALIAS) * font_p->width_byte) + ((col_start << FONT_ANTIALIAS) >> 3);
map_p += ((row_start << FONT_ANTIALIAS) * width_byte) + ((col_start << FONT_ANTIALIAS) >> 3);
#if FONT_ANTIALIAS != 0
opa_t opa_tmp = opa;
if(opa_tmp != OPA_COVER) opa_tmp = opa_tmp >> 2; /*Opacity per pixel (used when sum the pixels)*/
const uint8_t * map1_p = map_p;
const uint8_t * map2_p = map_p + font_p->width_byte;
const uint8_t * map2_p = map_p + width_byte;
uint8_t px_cnt;
for(row = row_start; row < row_end; row ++) {
col_byte_cnt = 0;
......@@ -228,10 +230,10 @@ void lv_vletter(const point_t * pos_p, const area_t * mask_p,
vdb_buf_tmp++;
}
map1_p += font_p->width_byte;
map2_p += font_p->width_byte;
map1_p += font_p->width_byte - col_byte_cnt;
map2_p += font_p->width_byte - col_byte_cnt;
map1_p += width_byte;
map2_p += width_byte;
map1_p += width_byte - col_byte_cnt;
map2_p += width_byte - col_byte_cnt;
vdb_buf_tmp += vdb_width - ((col_end) - (col_start)); /*Next row in VDB*/
}
#else
......@@ -255,7 +257,7 @@ void lv_vletter(const point_t * pos_p, const area_t * mask_p,
}
}
map_p += font_p->width_byte - col_byte_cnt;
map_p += width_byte - col_byte_cnt;
vdb_buf_tmp += vdb_width - (col_end - col_start); /*Next row in VDB*/
}
#endif
......
......@@ -209,7 +209,7 @@ bool lv_ta_signal(lv_obj_t * ta, lv_signal_t sign, void * param)
/**
* Insert a character to the current cursor position
* @param ta pointer to a text area object
* @param c a character
* @param c a character (could but UTF-8 code as well: 'Á' or txt_unicode_to_utf8(0x047C)
*/
void lv_ta_add_char(lv_obj_t * ta, uint32_t c)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment