Lines Matching refs:txt
35 static uint32_t lv_text_utf8_next(const char * txt, uint32_t * i);
36 static uint32_t lv_text_utf8_prev(const char * txt, uint32_t * i_start);
37 static uint32_t lv_text_utf8_get_byte_id(const char * txt, uint32_t utf8_id);
38 static uint32_t lv_text_utf8_get_char_id(const char * txt, uint32_t byte_id);
39 static uint32_t lv_text_utf8_get_length(const char * txt);
44 static uint32_t lv_text_iso8859_1_next(const char * txt, uint32_t * i);
45 static uint32_t lv_text_iso8859_1_prev(const char * txt, uint32_t * i_start);
46 static uint32_t lv_text_iso8859_1_get_byte_id(const char * txt, uint32_t utf8_id);
47 static uint32_t lv_text_iso8859_1_get_char_id(const char * txt, uint32_t byte_id);
48 static uint32_t lv_text_iso8859_1_get_length(const char * txt);
201 static uint32_t lv_text_get_next_word(const char * txt, const lv_font_t * font, in lv_text_get_next_word() argument
206 if(txt == NULL || txt[0] == '\0') return 0; in lv_text_get_next_word()
220 letter = lv_text_encoded_next(txt, &i_next); in lv_text_get_next_word()
224 while(txt[i] != '\0') { in lv_text_get_next_word()
225 letter_next = lv_text_encoded_next(txt, &i_next_next); in lv_text_get_next_word()
305 lv_text_encoded_prev(txt, &i); in lv_text_get_next_word()
321 uint32_t lv_text_get_next_line(const char * txt, uint32_t len, in lv_text_get_next_line() argument
327 if(txt == NULL) return 0; in lv_text_get_next_line()
328 if(txt[0] == '\0') return 0; in lv_text_get_next_line()
337 for(i = 0; i < len && txt[i] != '\n' && txt[i] != '\r' && txt[i] != '\0'; i++) { in lv_text_get_next_line()
340 if(i < len && txt[i] != '\0') i++; /*To go beyond `\n`*/ in lv_text_get_next_line()
350 while(i < len && txt[i] != '\0' && max_width > 0) { in lv_text_get_next_line()
355 …uint32_t advance = lv_text_get_next_word(&txt[i], font, letter_space, max_width, word_flag, &word_… in lv_text_get_next_line()
365 if(txt[0] == '\n' || txt[0] == '\r') break; in lv_text_get_next_line()
367 if(txt[i] == '\n' || txt[i] == '\r') { in lv_text_get_next_line()
376 uint32_t letter = lv_text_encoded_next(txt, &i); in lv_text_get_next_line()
389 int32_t lv_text_get_width(const char * txt, uint32_t length, const lv_font_t * font, int32_t letter… in lv_text_get_width() argument
391 if(txt == NULL) return 0; in lv_text_get_width()
393 if(txt[0] == '\0') return 0; in lv_text_get_width()
402 lv_text_encoded_letter_next_2(txt, &letter, &letter_next, &i); in lv_text_get_width()
420 int32_t lv_text_get_width_with_flags(const char * txt, uint32_t length, const lv_font_t * font, int… in lv_text_get_width_with_flags() argument
423 if(txt == NULL) return 0; in lv_text_get_width_with_flags()
425 if(txt[0] == '\0') return 0; in lv_text_get_width_with_flags()
435 lv_text_encoded_letter_next_2(txt, &letter, &letter_next, &i); in lv_text_get_width_with_flags()
480 void lv_text_cut(char * txt, uint32_t pos, uint32_t len) in lv_text_cut() argument
482 if(txt == NULL) return; in lv_text_cut()
484 size_t old_len = lv_strlen(txt); in lv_text_cut()
486 pos = lv_text_encoded_get_byte_id(txt, pos); /*Convert to byte index instead of letter index*/ in lv_text_cut()
487 len = lv_text_encoded_get_byte_id(&txt[pos], len); in lv_text_cut()
492 txt[i] = txt[i + len]; in lv_text_cut()
538 void lv_text_encoded_letter_next_2(const char * txt, uint32_t * letter, uint32_t * letter_next, uin… in lv_text_encoded_letter_next_2() argument
540 *letter = lv_text_encoded_next(txt, ofs); in lv_text_encoded_letter_next_2()
541 *letter_next = *letter != '\0' ? lv_text_encoded_next(&txt[*ofs], NULL) : 0; in lv_text_encoded_letter_next_2()
636 static uint32_t lv_text_utf8_next(const char * txt, uint32_t * i) in lv_text_utf8_next() argument
653 if(LV_IS_ASCII(txt[*i])) { in lv_text_utf8_next()
654 result = txt[*i]; in lv_text_utf8_next()
660 if(LV_IS_2BYTES_UTF8_CODE(txt[*i])) { in lv_text_utf8_next()
661 result = (uint32_t)(txt[*i] & 0x1F) << 6; in lv_text_utf8_next()
663 if(LV_IS_INVALID_UTF8_CODE(txt[*i])) return 0; in lv_text_utf8_next()
664 result += (txt[*i] & 0x3F); in lv_text_utf8_next()
668 else if(LV_IS_3BYTES_UTF8_CODE(txt[*i])) { in lv_text_utf8_next()
669 result = (uint32_t)(txt[*i] & 0x0F) << 12; in lv_text_utf8_next()
672 if(LV_IS_INVALID_UTF8_CODE(txt[*i])) return 0; in lv_text_utf8_next()
673 result += (uint32_t)(txt[*i] & 0x3F) << 6; in lv_text_utf8_next()
676 if(LV_IS_INVALID_UTF8_CODE(txt[*i])) return 0; in lv_text_utf8_next()
677 result += (txt[*i] & 0x3F); in lv_text_utf8_next()
681 else if(LV_IS_4BYTES_UTF8_CODE(txt[*i])) { in lv_text_utf8_next()
682 result = (uint32_t)(txt[*i] & 0x07) << 18; in lv_text_utf8_next()
685 if(LV_IS_INVALID_UTF8_CODE(txt[*i])) return 0; in lv_text_utf8_next()
686 result += (uint32_t)(txt[*i] & 0x3F) << 12; in lv_text_utf8_next()
689 if(LV_IS_INVALID_UTF8_CODE(txt[*i])) return 0; in lv_text_utf8_next()
690 result += (uint32_t)(txt[*i] & 0x3F) << 6; in lv_text_utf8_next()
693 if(LV_IS_INVALID_UTF8_CODE(txt[*i])) return 0; in lv_text_utf8_next()
694 result += txt[*i] & 0x3F; in lv_text_utf8_next()
711 static uint32_t lv_text_utf8_prev(const char * txt, uint32_t * i) in lv_text_utf8_prev() argument
721 c_size = lv_text_encoded_size(&txt[*i]); in lv_text_utf8_prev()
732 uint32_t letter = lv_text_encoded_next(txt, &i_tmp); /*Character found, get it*/ in lv_text_utf8_prev()
744 static uint32_t lv_text_utf8_get_byte_id(const char * txt, uint32_t utf8_id) in lv_text_utf8_get_byte_id() argument
748 for(i = 0; i < utf8_id && txt[byte_cnt] != '\0'; i++) { in lv_text_utf8_get_byte_id()
749 uint8_t c_size = lv_text_encoded_size(&txt[byte_cnt]); in lv_text_utf8_get_byte_id()
764 static uint32_t lv_text_utf8_get_char_id(const char * txt, uint32_t byte_id) in lv_text_utf8_get_char_id() argument
770 lv_text_encoded_next(txt, &i); /*'i' points to the next letter so use the prev. value*/ in lv_text_utf8_get_char_id()
783 static uint32_t lv_text_utf8_get_length(const char * txt) in lv_text_utf8_get_length() argument
788 while(txt[i] != '\0') { in lv_text_utf8_get_length()
789 lv_text_encoded_next(txt, &i); in lv_text_utf8_get_length()
844 static uint32_t lv_text_iso8859_1_next(const char * txt, uint32_t * i) in lv_text_iso8859_1_next() argument
846 if(i == NULL) return txt[0]; /*Get the next char*/ in lv_text_iso8859_1_next()
848 uint8_t letter = txt[*i]; in lv_text_iso8859_1_next()
859 static uint32_t lv_text_iso8859_1_prev(const char * txt, uint32_t * i) in lv_text_iso8859_1_prev() argument
861 if(i == NULL) return *(txt - 1); /*Get the prev. char*/ in lv_text_iso8859_1_prev()
864 uint8_t letter = txt[*i]; in lv_text_iso8859_1_prev()
876 static uint32_t lv_text_iso8859_1_get_byte_id(const char * txt, uint32_t utf8_id) in lv_text_iso8859_1_get_byte_id() argument
878 LV_UNUSED(txt); /*Unused*/ in lv_text_iso8859_1_get_byte_id()
889 static uint32_t lv_text_iso8859_1_get_char_id(const char * txt, uint32_t byte_id) in lv_text_iso8859_1_get_char_id() argument
891 LV_UNUSED(txt); /*Unused*/ in lv_text_iso8859_1_get_char_id()
901 static uint32_t lv_text_iso8859_1_get_length(const char * txt) in lv_text_iso8859_1_get_length() argument
903 return lv_strlen(txt); in lv_text_iso8859_1_get_length()