feat(example) add RTL scroll example

This commit is contained in:
Gabor Kiss-Vamosi
2021-05-26 23:05:07 +02:00
parent 20f3b2e04c
commit 46de101c97
4 changed files with 32 additions and 2 deletions

View File

@@ -22,6 +22,11 @@ Styling the scrollbars
.. lv_example:: scroll/lv_example_scroll_4
:language: c
Right to left scrolling
""""""""""""""""""""""""
.. lv_example:: scroll/lv_example_scroll_5
:language: c
MicroPython
^^^^^^^^^^^

View File

@@ -29,6 +29,7 @@ void lv_example_scroll_1(void);
void lv_example_scroll_2(void);
void lv_example_scroll_3(void);
void lv_example_scroll_4(void);
void lv_example_scroll_5(void);
/**********************

View File

@@ -0,0 +1,22 @@
#include "../lv_examples.h"
#if LV_BUILD_EXAMPLES && LV_FONT_DEJAVU_16_PERSIAN_HEBREW
/**
* Scrolling with Right To Left base direction
*/
void lv_example_scroll_5(void)
{
lv_obj_t * obj = lv_obj_create(lv_scr_act());
lv_obj_set_style_base_dir(obj, LV_BASE_DIR_RTL, 0);
lv_obj_set_size(obj, 200, 100);
lv_obj_center(obj);
lv_obj_t * label = lv_label_create(obj);
lv_label_set_text(label,"میکروکُنترولر (به انگلیسی: Microcontroller) گونه‌ای ریزپردازنده است که دارای حافظهٔ دسترسی تصادفی (RAM) و حافظهٔ فقط‌خواندنی (ROM)، تایمر، پورت‌های ورودی و خروجی (I/O) و درگاه ترتیبی (Serial Port پورت سریال)، درون خود تراشه است، و می‌تواند به تنهایی ابزارهای دیگر را کنترل کند. به عبارت دیگر یک میکروکنترلر، مدار مجتمع کوچکی است که از یک CPU کوچک و اجزای دیگری مانند تایمر، درگاه‌های ورودی و خروجی آنالوگ و دیجیتال و حافظه تشکیل شده‌است.");
lv_obj_set_width(label, 400);
lv_obj_set_style_text_font(label, &lv_font_dejavu_16_persian_hebrew, 0);
}
#endif

View File

@@ -413,8 +413,10 @@ LV_ATTRIBUTE_FAST_MEM void lv_draw_letter(const lv_point_t * pos_p, const lv_are
if(g_ret == false) {
/*Add warning if the dsc is not found
*but do not print warning for non printable ASCII chars (e.g. '\n')*/
if(letter >= 0x20 && letter != 0xf8ff) { /*0xf8ff == LV_SYMBOL_DUMMY*/
LV_LOG_WARN("lv_draw_letter: glyph dsc. not found");
if(letter >= 0x20 &&
letter != 0xf8ff && /*LV_SYMBOL_DUMMY*/
letter != 0x200c) { /*ZERO WIDTH NON-JOINER*/
LV_LOG_WARN("lv_draw_letter: glyph dsc. not found for U+%X", letter);
}
return;
}