1 #include "../../lv_examples.h"
2 #if LV_USE_TINY_TTF && LV_TINY_TTF_FILE_SUPPORT && LV_BUILD_EXAMPLES
3 
4 /**
5  * Load a font with Tiny_TTF from file
6  */
lv_example_tiny_ttf_2(void)7 void lv_example_tiny_ttf_2(void)
8 {
9     /*Create style with the new font*/
10     static lv_style_t style;
11     lv_style_init(&style);
12     lv_font_t * font = lv_tiny_ttf_create_file("A:lvgl/examples/libs/tiny_ttf/Ubuntu-Medium.ttf", 30);
13     lv_style_set_text_font(&style, font);
14     lv_style_set_text_align(&style, LV_TEXT_ALIGN_CENTER);
15 
16     /*Create a label with the new style*/
17     lv_obj_t * label = lv_label_create(lv_screen_active());
18     lv_obj_add_style(label, &style, 0);
19     lv_label_set_text(label, "Hello world\nI'm a font\ncreated\nwith Tiny TTF");
20     lv_obj_center(label);
21 }
22 #endif
23