1 #include "../../lv_examples.h"
2 #if LV_USE_TINY_TTF && LV_BUILD_EXAMPLES
3 
4 /**
5  * Load a font with Tiny_TTF
6  */
lv_example_tiny_ttf_1(void)7 void lv_example_tiny_ttf_1(void)
8 {
9     extern const uint8_t ubuntu_font[];
10     extern const int ubuntu_font_size;
11 
12     /*Create style with the new font*/
13     static lv_style_t style;
14     lv_style_init(&style);
15     lv_font_t * font = lv_tiny_ttf_create_data(ubuntu_font, ubuntu_font_size, 30);
16     lv_style_set_text_font(&style, font);
17     lv_style_set_text_align(&style, LV_TEXT_ALIGN_CENTER);
18 
19     /*Create a label with the new style*/
20     lv_obj_t * label = lv_label_create(lv_screen_active());
21     lv_obj_add_style(label, &style, 0);
22     lv_label_set_text(label, "Hello world\nI'm a font\ncreated\nwith Tiny TTF");
23     lv_obj_center(label);
24 }
25 #endif
26