Advertisement
honey_the_codewitch

lvgl tiny_ttf

Sep 11th, 2022
303
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.66 KB | None | 0 0
  1. const uint8_t* data = Ubuntu_data;
  2. const size_t data_size = sizeof(Ubuntu_data);
  3. // initialize the const buffer filesystem (done once)
  4. lv_fs_cbfs_init();
  5. char path[256];
  6. // create a path to the pointer
  7. lv_fs_cbfs_create(path,sizeof(path),data,data_size);
  8.  
  9. // create a font with a line height of 40 from the path
  10. // path can be a file, a cbfs pointer, etc.
  11. lv_font_t* font = lv_tiny_ttf_create(path,40,NULL);
  12. // create simple label
  13. lv_obj_t *label = lv_label_create( lv_scr_act() );
  14. lv_style_selector_t selector=0;
  15. lv_obj_set_style_text_font(label,font,selector);
  16. lv_label_set_text( label, "honey\nthe\nmonster");
  17. lv_obj_align( label, LV_ALIGN_CENTER, 0, 0 );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement