arch add small 3rd party libs to lvgl (#2569)
* move png, sjpg, bmp, gif, fs_if to extra/libs * reorganize the examples * update lv_conf_internal.h * fix warnings * add freetype * remove unused assets * add the new libs to build tests * update the docs
This commit is contained in:
committed by
GitHub
parent
b20a706112
commit
18f61c5f77
BIN
examples/libs/freetype/arial.ttf
Normal file
BIN
examples/libs/freetype/arial.ttf
Normal file
Binary file not shown.
6
examples/libs/freetype/index.rst
Normal file
6
examples/libs/freetype/index.rst
Normal file
@@ -0,0 +1,6 @@
|
||||
Open a front with FreeTpye
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""
|
||||
|
||||
.. lv_example:: libs/freetype/lv_example_freetype_1
|
||||
:language: c
|
||||
|
||||
38
examples/libs/freetype/lv_example_freetype.h
Normal file
38
examples/libs/freetype/lv_example_freetype.h
Normal file
@@ -0,0 +1,38 @@
|
||||
/**
|
||||
* @file lv_example_freetype.h
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LV_EXAMPLE_FREETYPE_H
|
||||
#define LV_EXAMPLE_FREETYPE_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
void lv_example_freetype_1(void);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_EXAMPLE_FREETYPE_H*/
|
||||
30
examples/libs/freetype/lv_example_freetype_1.c
Normal file
30
examples/libs/freetype/lv_example_freetype_1.c
Normal file
@@ -0,0 +1,30 @@
|
||||
#include "../../lv_examples.h"
|
||||
#if LV_USE_FREETYPE && LV_BUILD_EXAMPLES
|
||||
|
||||
/**
|
||||
* Load a font with FreeType
|
||||
*/
|
||||
void lv_example_freetype_1(void)
|
||||
{
|
||||
/*Create a font*/
|
||||
static lv_ft_info_t info;
|
||||
/*FreeType uses C standard file system, so no driver letter is required.*/
|
||||
info.name = "./lvgl/examples/libs/freetype/arial.ttf";
|
||||
info.weight = 24;
|
||||
info.style = FT_FONT_STYLE_NORMAL;
|
||||
lv_ft_font_init(&info);
|
||||
|
||||
/*Create style with the new font*/
|
||||
static lv_style_t style;
|
||||
lv_style_init(&style);
|
||||
lv_style_set_text_font(&style, info.font);
|
||||
lv_style_set_text_align(&style, LV_TEXT_ALIGN_CENTER);
|
||||
|
||||
/*Create a label with the new style*/
|
||||
lv_obj_t * label = lv_label_create(lv_scr_act());
|
||||
lv_obj_add_style(label, &style, 0);
|
||||
lv_label_set_text(label, "Hello world\nI'm a font created with FreeType");
|
||||
lv_obj_center(label);
|
||||
}
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user