mirror of
https://github.com/lvgl/lvgl.git
synced 2024-11-23 17:53:45 +08:00
Merge branch 'feat/arabic' into dev-7.0
This commit is contained in:
commit
3ac2c390c6
@ -446,6 +446,11 @@ typedef void * lv_font_user_data_t;
|
||||
#define LV_BIDI_BASE_DIR_DEF LV_BIDI_DIR_AUTO
|
||||
#endif
|
||||
|
||||
/* Enable Arabic/Persian processing
|
||||
* In these languages characters should be replaced with
|
||||
* an other form based on their position in the text */
|
||||
#define LV_USE_ARABIC_PERSIAN_CHARS 0
|
||||
|
||||
/*Change the built in (v)snprintf functions*/
|
||||
#define LV_SPRINTF_CUSTOM 0
|
||||
#if LV_SPRINTF_CUSTOM
|
||||
|
1
lvgl.h
1
lvgl.h
@ -34,6 +34,7 @@ extern "C" {
|
||||
#include "src/lv_font/lv_font.h"
|
||||
#include "src/lv_font/lv_font_fmt_txt.h"
|
||||
#include "src/lv_misc/lv_bidi.h"
|
||||
#include "src/lv_misc/lv_txt_ap.h"
|
||||
#include "src/lv_misc/lv_printf.h"
|
||||
|
||||
#include "src/lv_widgets/lv_btn.h"
|
||||
|
@ -675,6 +675,13 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Enable Arabic/Persian processing
|
||||
* In these languages characters should be replaced with
|
||||
* an other form based on their position in the text */
|
||||
#ifndef LV_USE_ARABIC_PERSIAN_CHARS
|
||||
#define LV_USE_ARABIC_PERSIAN_CHARS 0
|
||||
#endif
|
||||
|
||||
/*Change the built in (v)snprintf functions*/
|
||||
#ifndef LV_SPRINTF_CUSTOM
|
||||
#define LV_SPRINTF_CUSTOM 0
|
||||
|
@ -22,6 +22,7 @@ CSRCS += lv_font_montserrat_48.c
|
||||
CSRCS += lv_font_montserrat_12_subpx.c
|
||||
CSRCS += lv_font_montserrat_28_compressed.c
|
||||
CSRCS += lv_font_unscii_8.c
|
||||
CSRCS += lv_font_ap_18.c
|
||||
|
||||
DEPPATH += --dep-path $(LVGL_DIR)/$(LVGL_DIR_NAME)/src/lv_font
|
||||
VPATH += :$(LVGL_DIR)/$(LVGL_DIR_NAME)/src/lv_font
|
||||
|
5501
src/lv_font/lv_font_ap_18.c
Normal file
5501
src/lv_font/lv_font_ap_18.c
Normal file
File diff suppressed because it is too large
Load Diff
@ -156,6 +156,11 @@ bool lv_bidi_letter_is_rtl(uint32_t letter)
|
||||
if(letter >= 0x5d0 && letter <= 0x5ea) return true;
|
||||
if(letter == 0x202E) return true; /*Unicode of LV_BIDI_RLO*/
|
||||
|
||||
/* Check for Persian and Arabic characters [https://en.wikipedia.org/wiki/Arabic_script_in_Unicode]*/
|
||||
if(letter >= 0x600 && letter <= 0x6FF) return true;
|
||||
if(letter >= 0xFB50 && letter <= 0xFDFF) return true;
|
||||
if(letter >= 0xFE70 && letter <= 0xFEFF) return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -7,6 +7,7 @@ CSRCS += lv_mem.c
|
||||
CSRCS += lv_ll.c
|
||||
CSRCS += lv_color.c
|
||||
CSRCS += lv_txt.c
|
||||
CSRCS += lv_txt_ap.c
|
||||
CSRCS += lv_math.c
|
||||
CSRCS += lv_log.c
|
||||
CSRCS += lv_gc.c
|
||||
@ -14,6 +15,7 @@ CSRCS += lv_utils.c
|
||||
CSRCS += lv_async.c
|
||||
CSRCS += lv_printf.c
|
||||
CSRCS += lv_bidi.c
|
||||
CSRCS += lv_txt_ap.c
|
||||
|
||||
DEPPATH += --dep-path $(LVGL_DIR)/$(LVGL_DIR_NAME)/src/lv_misc
|
||||
VPATH += :$(LVGL_DIR)/$(LVGL_DIR_NAME)/src/lv_misc
|
||||
|
204
src/lv_misc/lv_txt_ap.c
Normal file
204
src/lv_misc/lv_txt_ap.c
Normal file
@ -0,0 +1,204 @@
|
||||
/**
|
||||
* @file lv_txt_ap.c
|
||||
*
|
||||
*/
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include <stddef.h>
|
||||
#include "lv_bidi.h"
|
||||
#include "lv_txt.h"
|
||||
#include "lv_txt_ap.h"
|
||||
#include "../lv_draw/lv_draw.h"
|
||||
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
static uint32_t lv_ap_get_char_index(uint16_t c);
|
||||
|
||||
/**********************
|
||||
* STATIC VARIABLES
|
||||
**********************/
|
||||
|
||||
#if LV_USE_ARABIC_PERSIAN_CHARS == 1
|
||||
const ap_chars_map_t ap_chars_map[]={
|
||||
/* {Key Offset, End, Beginning, Middle, Isolated, {conjunction}} */
|
||||
{1 , 0xFE84, -1, 0, -1, {1, 0}}, // أ
|
||||
{2 , 0xFE86, -1, 0, -1, {1, 0}}, // ؤ
|
||||
{3 , 0xFE88, -1, 0, -1, {1, 0}}, // ﺇ
|
||||
{4 , 0xFE8A, 1, 2, -1, {1, 0}}, // ئ
|
||||
{5 , 0xFE8E, -1, 0, -1, {1, 0}}, // آ
|
||||
{6 , 0xFE90, 1, 2, -1, {1, 1}}, // ب
|
||||
{92 , 0xFB57, 1, 2, -1, {1, 1}}, // پ
|
||||
{8 , 0xFE96, 1, 2, -1, {1, 1}}, // ت
|
||||
{9 , 0xFE9A, 1, 2, -1, {1, 1}}, // ث
|
||||
{10 , 0xFE9E, 1, 2, -1, {1, 1}}, // ج
|
||||
{100, 0xFB7B, 1, 2, -1, {1, 1}}, // چ
|
||||
{11 , 0xFEA2, 1, 2, -1, {1, 1}}, // ح
|
||||
{12 , 0xFEA6, 1, 2, -1, {1, 1}}, // خ
|
||||
{13 , 0xFEAA, -1, 0, -1, {1, 0}}, // د
|
||||
{14 , 0xFEAC, -1, 0, -1, {1, 0}}, // ذ
|
||||
{15 , 0xFEAE, -1, 0, -1, {1, 0}}, // ر
|
||||
{16 , 0xFEB0, -1, 0, -1, {1, 0}}, // ز
|
||||
{118, 0xFB8B, -1, 0, -1, {1, 0}}, // ژ
|
||||
{17 , 0xFEB2, 1, 2, -1, {1, 1}}, // س
|
||||
{18 , 0xFEB6, 1, 2, -1, {1, 1}}, // ش
|
||||
{19 , 0xFEBA, 1, 2, -1, {1, 1}}, // ص
|
||||
{20 , 0xFEBE, 1, 2, -1, {1, 1}}, // ض
|
||||
{21 , 0xFEC2, 1, 2, -1, {1, 1}}, // ط
|
||||
{22 , 0xFEC6, 1, 2, -1, {1, 1}}, // ظ
|
||||
{23 , 0xFECA, 1, 2, -1, {1, 1}}, // ع
|
||||
{24 , 0xFECE, 1, 2, -1, {1, 1}}, // غ
|
||||
{31 , 0xFED2, 1, 2, -1, {1, 1}}, // ف
|
||||
{32 , 0xFED6, 1, 2, -1, {1, 1}}, // ق
|
||||
{135, 0xFB8F, 1, 2, -1, {1, 1}}, // ک
|
||||
{33, 0xFEDA, 1, 2, -1, {1, 1}}, // ﻙ
|
||||
{141, 0xFB93, 1, 2, -1, {1, 1}}, // گ
|
||||
{34 , 0xFEDE, 1, 2, -1, {1, 1}}, // ل
|
||||
{35 , 0xFEE2, 1, 2, -1, {1, 1}}, // م
|
||||
{36 , 0xFEE6, 1, 2, -1, {1, 1}}, // ن
|
||||
{38 , 0xFEEE, -1, 0, -1, {1, 0}}, // و
|
||||
{37 , 0xFEEA, 1, 2, -1, {1, 1}}, // ه
|
||||
{39 , 0xFBFD, 1, 2, -1, {1, 1}}, // ي
|
||||
{40 , 0xFEF2, 1, 2, -1, {1, 1}}, // ي
|
||||
{170 , 0xFBFD, 1, 2, -1, {1, 1}}, // ی
|
||||
{7 , 0xFE94, 1, 2, -1, {1, 0}}, // ة
|
||||
{206, 0x06F0, 1, 2, -1, {0, 0}}, // ۰
|
||||
{207, 0x06F1, 0, 0, 0, {0, 0}}, // ۱
|
||||
{208, 0x06F2, 0, 0, 0, {0, 0}}, // ۲
|
||||
{209, 0x06F3, 0, 0, 0, {0, 0}}, // ۳
|
||||
{210, 0x06F4, 0, 0, 0, {0, 0}}, // ۴
|
||||
{211, 0x06F5, 0, 0, 0, {0, 0}}, // ۵
|
||||
{212, 0x06F6, 0, 0, 0, {0, 0}}, // ۶
|
||||
{213, 0x06F7, 0, 0, 0, {0, 0}}, // ۷
|
||||
{214, 0x06F8, 0, 0, 0, {0, 0}}, // ۸
|
||||
{215, 0x06F9, 0, 0, 0, {0, 0}}, // ۹
|
||||
LV_AP_END_CHARS_LIST
|
||||
};
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* GLOBAL FUNCTIONS
|
||||
**********************/
|
||||
uint32_t lv_txt_ap_calc_bytes_cnt(const char * txt){
|
||||
uint32_t txt_length = 0;
|
||||
uint32_t chars_cnt = 0;
|
||||
uint32_t current_ap_idx = 0;
|
||||
uint32_t i, j;
|
||||
uint32_t ch_enc;
|
||||
|
||||
txt_length = lv_txt_get_encoded_length(txt);
|
||||
|
||||
i=0;
|
||||
j=0;
|
||||
while(i<txt_length){
|
||||
ch_enc = lv_txt_encoded_next(txt, &j);
|
||||
current_ap_idx = lv_ap_get_char_index(ch_enc);
|
||||
|
||||
if(current_ap_idx != LV_UNDEF_ARABIC_PERSIAN_CHARS)
|
||||
ch_enc = ap_chars_map[current_ap_idx].char_end_form;
|
||||
|
||||
if(ch_enc <=0x7F)
|
||||
chars_cnt++;
|
||||
else if(ch_enc <=0x7FFF)
|
||||
chars_cnt+=2;
|
||||
else
|
||||
chars_cnt+=3;
|
||||
|
||||
i++;
|
||||
}
|
||||
|
||||
return chars_cnt + 1;
|
||||
}
|
||||
|
||||
|
||||
void lv_txt_ap_proc(const char * txt,char * txt_out)
|
||||
{
|
||||
uint32_t txt_length=0;
|
||||
uint32_t index_current,idx_next,idx_previous,i,j;
|
||||
uint32_t * ch_enc;
|
||||
char * txt_out_temp;
|
||||
|
||||
txt_length = lv_txt_get_encoded_length(txt);
|
||||
|
||||
ch_enc = (uint32_t *)lv_mem_alloc(sizeof(uint32_t) * (txt_length + 1));
|
||||
|
||||
i=0;
|
||||
j=0;
|
||||
while(j<txt_length)
|
||||
ch_enc[j++] = lv_txt_encoded_next(txt, &i);
|
||||
|
||||
ch_enc[j] = 0;
|
||||
|
||||
i=0;
|
||||
idx_previous = LV_UNDEF_ARABIC_PERSIAN_CHARS;
|
||||
while(i<txt_length){
|
||||
index_current = lv_ap_get_char_index(ch_enc[i]);
|
||||
idx_next = lv_ap_get_char_index(ch_enc[i+1]);
|
||||
|
||||
if(index_current == LV_UNDEF_ARABIC_PERSIAN_CHARS)
|
||||
{
|
||||
i++;
|
||||
idx_previous = LV_UNDEF_ARABIC_PERSIAN_CHARS;
|
||||
continue;
|
||||
}
|
||||
|
||||
uint8_t conjunction_to_previuse = (i==0 || idx_previous == LV_UNDEF_ARABIC_PERSIAN_CHARS) ? 0 : ap_chars_map[idx_previous].ap_chars_conjunction.conj_to_next;
|
||||
uint8_t conjunction_to_next = ((i==txt_length-1) || idx_next == LV_UNDEF_ARABIC_PERSIAN_CHARS) ? 0 : ap_chars_map[idx_next].ap_chars_conjunction.conj_to_previous;
|
||||
|
||||
if(conjunction_to_previuse && conjunction_to_next)
|
||||
ch_enc[i] = ap_chars_map[index_current].char_end_form+ap_chars_map[index_current].char_middle_form_offset;
|
||||
else if(!conjunction_to_previuse && conjunction_to_next)
|
||||
ch_enc[i] = ap_chars_map[index_current].char_end_form+ap_chars_map[index_current].char_begining_form_offset;
|
||||
else if(conjunction_to_previuse && !conjunction_to_next)
|
||||
ch_enc[i] = ap_chars_map[index_current].char_end_form;
|
||||
else
|
||||
ch_enc[i] = ap_chars_map[index_current].char_end_form+ap_chars_map[index_current].char_isolated_form_offset;
|
||||
idx_previous = index_current;
|
||||
i++;
|
||||
}
|
||||
|
||||
txt_out_temp = txt_out;
|
||||
i=0;
|
||||
|
||||
while(i<txt_length){
|
||||
if((ch_enc[i]) <=0x7F){
|
||||
*(txt_out_temp++) = ch_enc[i];
|
||||
}else if(ch_enc[i] <=0x7FFF){
|
||||
*(txt_out_temp++) = 0xC0 | ((ch_enc[i]>>6) & 0x3F);
|
||||
*(txt_out_temp++) = 0x80 | (ch_enc[i] & 0x3F);
|
||||
}else {
|
||||
*(txt_out_temp++) = 0xE0 | ((ch_enc[i]>>12) & 0x3F);
|
||||
*(txt_out_temp++) = 0x80 | ((ch_enc[i]>>6) & 0x3F);
|
||||
*(txt_out_temp++) = 0x80 | (ch_enc[i] & 0x3F);
|
||||
}
|
||||
i++;
|
||||
}
|
||||
*(txt_out_temp) = '\0';
|
||||
lv_mem_free(ch_enc);
|
||||
}
|
||||
/**********************
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
|
||||
static uint32_t lv_ap_get_char_index(uint16_t c){
|
||||
for(uint8_t i=0;ap_chars_map[i].char_end_form;i++){
|
||||
if(c == (ap_chars_map[i].char_offset + LV_AP_ALPHABET_BASE_CODE))
|
||||
return i;
|
||||
}
|
||||
return LV_UNDEF_ARABIC_PERSIAN_CHARS;
|
||||
}
|
||||
|
||||
#endif
|
59
src/lv_misc/lv_txt_ap.h
Normal file
59
src/lv_misc/lv_txt_ap.h
Normal file
@ -0,0 +1,59 @@
|
||||
/**
|
||||
* @file lv_txt_ap.h
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LV_TXT_AP_H
|
||||
#define LV_TXT_AP_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include <stddef.h>
|
||||
#include "lv_bidi.h"
|
||||
#include "lv_txt.h"
|
||||
#include "../lv_draw/lv_draw.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
#define LV_UNDEF_ARABIC_PERSIAN_CHARS (UINT32_MAX)
|
||||
#define LV_AP_ALPHABET_BASE_CODE 0x0622
|
||||
#define LV_AP_END_CHARS_LIST {0,0,0,0,0,{0,0}}
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
typedef struct
|
||||
{
|
||||
uint8_t char_offset;
|
||||
uint16_t char_end_form;
|
||||
int8_t char_begining_form_offset;
|
||||
int8_t char_middle_form_offset;
|
||||
int8_t char_isolated_form_offset;
|
||||
struct
|
||||
{
|
||||
uint8_t conj_to_previous;
|
||||
uint8_t conj_to_next;
|
||||
} ap_chars_conjunction;
|
||||
} ap_chars_map_t;
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
uint32_t lv_txt_ap_calc_bytes_cnt(const char * txt);
|
||||
void lv_txt_ap_proc(const char * txt,char * txt_out);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /*LV_TXT_AP_H*/
|
@ -649,7 +649,6 @@ static void lv_cont_layout_pretty(lv_obj_t * cont)
|
||||
*/
|
||||
static void lv_cont_layout_grid(lv_obj_t * cont)
|
||||
{
|
||||
|
||||
lv_coord_t w_fit = lv_obj_get_width_fit(cont);
|
||||
lv_coord_t inner = lv_obj_get_style_pad_inner(cont, LV_CONT_PART_MAIN);
|
||||
lv_coord_t y_ofs = inner + lv_obj_get_height(lv_obj_get_child(cont, NULL));
|
||||
|
@ -196,25 +196,48 @@ void lv_label_set_text(lv_obj_t * label, const char * text)
|
||||
|
||||
if(ext->text == text) {
|
||||
/*If set its own text then reallocate it (maybe its size changed)*/
|
||||
#if LV_USE_ARABIC_PERSIAN_CHARS
|
||||
/*Get the size of the text and process it*/
|
||||
size_t len = lv_txt_ap_calc_bytes_cnt(text);
|
||||
|
||||
ext->text = lv_mem_realloc(ext->text, len);
|
||||
LV_ASSERT_MEM(ext->text);
|
||||
if(ext->text == NULL) return;
|
||||
|
||||
lv_txt_ap_proc(ext->text, ext->text);
|
||||
#else
|
||||
ext->text = lv_mem_realloc(ext->text, strlen(ext->text) + 1);
|
||||
#endif
|
||||
|
||||
LV_ASSERT_MEM(ext->text);
|
||||
if(ext->text == NULL) return;
|
||||
}
|
||||
else {
|
||||
/*Allocate space for the new text*/
|
||||
size_t len = strlen(text) + 1;
|
||||
/*Free the old text*/
|
||||
if(ext->text != NULL && ext->static_txt == 0) {
|
||||
lv_mem_free(ext->text);
|
||||
ext->text = NULL;
|
||||
}
|
||||
|
||||
ext->text = lv_mem_alloc(len);
|
||||
#if LV_USE_ARABIC_PERSIAN_CHARS
|
||||
/*Get the size of the text and process it*/
|
||||
size_t len = lv_txt_ap_calc_bytes_cnt(text);
|
||||
|
||||
ext->text = lv_mem_alloc(len);
|
||||
LV_ASSERT_MEM(ext->text);
|
||||
if(ext->text == NULL) return;
|
||||
|
||||
lv_txt_ap_proc(text, ext->text);
|
||||
#else
|
||||
/*Get the size of the text*/
|
||||
size_t len = strlen(text) + 1;
|
||||
|
||||
/*Allocate space for the new text*/
|
||||
ext->text = lv_mem_alloc(len);
|
||||
LV_ASSERT_MEM(ext->text);
|
||||
if(ext->text == NULL) return;
|
||||
strcpy(ext->text, text);
|
||||
#endif
|
||||
|
||||
/*Now the text is dynamically allocated*/
|
||||
ext->static_txt = 0;
|
||||
@ -248,15 +271,38 @@ void lv_label_set_text_fmt(lv_obj_t * label, const char * fmt, ...)
|
||||
ext->text = NULL;
|
||||
}
|
||||
|
||||
|
||||
va_list ap, ap2;
|
||||
va_start(ap, fmt);
|
||||
va_copy(ap2, ap);
|
||||
|
||||
/*Allocate space for the new text by using trick from C99 standard section 7.19.6.12 */
|
||||
uint32_t len = lv_vsnprintf(NULL, 0, fmt, ap);
|
||||
|
||||
va_end(ap);
|
||||
|
||||
#if LV_USE_ARABIC_PERSIAN_CHARS
|
||||
/*Put together the text according to the format string*/
|
||||
char * raw_txt = lv_mem_buf_get(len + 1);
|
||||
LV_ASSERT_MEM(raw_txt);
|
||||
if(raw_txt == NULL) {
|
||||
va_end(ap2);
|
||||
return;
|
||||
}
|
||||
|
||||
lv_vsnprintf(raw_txt, len + 1, fmt, ap2);
|
||||
|
||||
/*Get the size of the Arabic text and process it*/
|
||||
size_t len_ap = lv_txt_ap_calc_bytes_cnt(raw_txt);
|
||||
ext->text = lv_mem_alloc(len_ap + 1);
|
||||
LV_ASSERT_MEM(ext->text);
|
||||
if(ext->text == NULL) {
|
||||
va_end(ap2);
|
||||
return;
|
||||
}
|
||||
lv_txt_ap_proc(raw_txt, ext->text);
|
||||
|
||||
lv_mem_buf_release(raw_txt);
|
||||
#else
|
||||
ext->text = lv_mem_alloc(len + 1);
|
||||
LV_ASSERT_MEM(ext->text);
|
||||
if(ext->text == NULL) {
|
||||
@ -266,6 +312,7 @@ void lv_label_set_text_fmt(lv_obj_t * label, const char * fmt, ...)
|
||||
ext->text[len - 1] = 0; /* Ensure NULL termination */
|
||||
|
||||
lv_vsnprintf(ext->text, len + 1, fmt, ap2);
|
||||
#endif
|
||||
|
||||
va_end(ap2);
|
||||
ext->static_txt = 0; /*Now the text is dynamically allocated*/
|
||||
@ -273,43 +320,6 @@ void lv_label_set_text_fmt(lv_obj_t * label, const char * fmt, ...)
|
||||
lv_label_refr_text(label);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a new text for a label from a character array. The array don't has to be '\0' terminated.
|
||||
* Memory will be allocated to store the array by the label.
|
||||
* @param label pointer to a label object
|
||||
* @param array array of characters or NULL to refresh the label
|
||||
* @param size the size of 'array' in bytes
|
||||
*/
|
||||
void lv_label_set_array_text(lv_obj_t * label, const char * array, uint16_t size)
|
||||
{
|
||||
LV_ASSERT_OBJ(label, LV_OBJX_NAME);
|
||||
|
||||
lv_obj_invalidate(label);
|
||||
|
||||
lv_label_ext_t * ext = lv_obj_get_ext_attr(label);
|
||||
|
||||
/*If trying to set its own text or the array is NULL then refresh */
|
||||
if(array == ext->text || array == NULL) {
|
||||
lv_label_refr_text(label);
|
||||
return;
|
||||
}
|
||||
|
||||
/*Allocate space for the new text*/
|
||||
if(ext->text != NULL && ext->static_txt == 0) {
|
||||
lv_mem_free(ext->text);
|
||||
ext->text = NULL;
|
||||
}
|
||||
ext->text = lv_mem_alloc(size + 1);
|
||||
LV_ASSERT_MEM(ext->text);
|
||||
if(ext->text == NULL) return;
|
||||
|
||||
memcpy(ext->text, array, size);
|
||||
ext->text[size] = '\0';
|
||||
ext->static_txt = 0; /*Now the text is dynamically allocated*/
|
||||
|
||||
lv_label_refr_text(label);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a static text. It will not be saved by the label so the 'text' variable
|
||||
* has to be 'alive' while the label exist.
|
||||
|
@ -135,15 +135,6 @@ void lv_label_set_text(lv_obj_t * label, const char * text);
|
||||
*/
|
||||
void lv_label_set_text_fmt(lv_obj_t * label, const char * fmt, ...);
|
||||
|
||||
/**
|
||||
* Set a new text for a label from a character array. The array don't has to be '\0' terminated.
|
||||
* Memory will be allocated to store the array by the label.
|
||||
* @param label pointer to a label object
|
||||
* @param array array of characters or NULL to refresh the label
|
||||
* @param size the size of 'array' in bytes
|
||||
*/
|
||||
void lv_label_set_array_text(lv_obj_t * label, const char * array, uint16_t size);
|
||||
|
||||
/**
|
||||
* Set a static text. It will not be saved by the label so the 'text' variable
|
||||
* has to be 'alive' while the label exist.
|
||||
|
@ -320,6 +320,7 @@ advanced_features = {
|
||||
"LV_FONT_MONTSERRAT_28_COMPRESSED":1,
|
||||
"LV_FONT_UNSCII_8":1,
|
||||
"LV_USE_BIDI": 1,
|
||||
"LV_USE_REVERSE_ARABIC_PERSIAN_CHARS":1,
|
||||
"LV_USE_OBJ_REALIGN": 1,
|
||||
"LV_FONT_FMT_TXT_LARGE":1,
|
||||
"LV_FONT_SUBPX_BGR":1,
|
||||
|
Loading…
Reference in New Issue
Block a user