mirror of
https://github.com/lvgl/lvgl.git
synced 2026-05-31 16:27:03 +08:00
feat(example) add RTL scroll example
This commit is contained in:
@@ -22,6 +22,11 @@ Styling the scrollbars
|
|||||||
.. lv_example:: scroll/lv_example_scroll_4
|
.. lv_example:: scroll/lv_example_scroll_4
|
||||||
:language: c
|
:language: c
|
||||||
|
|
||||||
|
Right to left scrolling
|
||||||
|
""""""""""""""""""""""""
|
||||||
|
.. lv_example:: scroll/lv_example_scroll_5
|
||||||
|
:language: c
|
||||||
|
|
||||||
|
|
||||||
MicroPython
|
MicroPython
|
||||||
^^^^^^^^^^^
|
^^^^^^^^^^^
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ void lv_example_scroll_1(void);
|
|||||||
void lv_example_scroll_2(void);
|
void lv_example_scroll_2(void);
|
||||||
void lv_example_scroll_3(void);
|
void lv_example_scroll_3(void);
|
||||||
void lv_example_scroll_4(void);
|
void lv_example_scroll_4(void);
|
||||||
|
void lv_example_scroll_5(void);
|
||||||
|
|
||||||
|
|
||||||
/**********************
|
/**********************
|
||||||
|
|||||||
@@ -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
|
||||||
@@ -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) {
|
if(g_ret == false) {
|
||||||
/*Add warning if the dsc is not found
|
/*Add warning if the dsc is not found
|
||||||
*but do not print warning for non printable ASCII chars (e.g. '\n')*/
|
*but do not print warning for non printable ASCII chars (e.g. '\n')*/
|
||||||
if(letter >= 0x20 && letter != 0xf8ff) { /*0xf8ff == LV_SYMBOL_DUMMY*/
|
if(letter >= 0x20 &&
|
||||||
LV_LOG_WARN("lv_draw_letter: glyph dsc. not found");
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user