Initial commit: TXW82x FPV v2.7.0.7-42229 SDK + project sources
This commit is contained in:
BIN
sdk/lib/lvgl/examples/libs/tiny_ttf/Ubuntu-Medium.ttf
Normal file
BIN
sdk/lib/lvgl/examples/libs/tiny_ttf/Ubuntu-Medium.ttf
Normal file
Binary file not shown.
13
sdk/lib/lvgl/examples/libs/tiny_ttf/index.rst
Normal file
13
sdk/lib/lvgl/examples/libs/tiny_ttf/index.rst
Normal file
@@ -0,0 +1,13 @@
|
||||
Open a front with Tiny TTF from data array
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""
|
||||
|
||||
.. lv_example:: libs/tiny_ttf/lv_example_tiny_ttf_1
|
||||
:language: c
|
||||
|
||||
|
||||
Load a font with Tiny_TTF from file
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""
|
||||
|
||||
.. lv_example:: libs/tiny_ttf/lv_example_tiny_ttf_2
|
||||
:language: c
|
||||
|
||||
39
sdk/lib/lvgl/examples/libs/tiny_ttf/lv_example_tiny_ttf.h
Normal file
39
sdk/lib/lvgl/examples/libs/tiny_ttf/lv_example_tiny_ttf.h
Normal file
@@ -0,0 +1,39 @@
|
||||
/**
|
||||
* @file lv_example_tiny_ttf.h
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LV_EXAMPLE_TINY_TTF_H
|
||||
#define LV_EXAMPLE_TINY_TTF_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
void lv_example_tiny_ttf_1(void);
|
||||
void lv_example_tiny_ttf_2(void);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_EXAMPLE_TINY_TTF_H*/
|
||||
24
sdk/lib/lvgl/examples/libs/tiny_ttf/lv_example_tiny_ttf_1.c
Normal file
24
sdk/lib/lvgl/examples/libs/tiny_ttf/lv_example_tiny_ttf_1.c
Normal file
@@ -0,0 +1,24 @@
|
||||
#include "../../lv_examples.h"
|
||||
#if LV_USE_TINY_TTF && LV_BUILD_EXAMPLES
|
||||
|
||||
#include "ubuntu_font.h"
|
||||
|
||||
/**
|
||||
* Load a font with Tiny_TTF
|
||||
*/
|
||||
void lv_example_tiny_ttf_1(void)
|
||||
{
|
||||
/*Create style with the new font*/
|
||||
static lv_style_t style;
|
||||
lv_style_init(&style);
|
||||
lv_font_t * font = lv_tiny_ttf_create_data(ubuntu_font, sizeof(ubuntu_font), 30);
|
||||
lv_style_set_text_font(&style, 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\ncreated\nwith Tiny TTF");
|
||||
lv_obj_center(label);
|
||||
}
|
||||
#endif
|
||||
16
sdk/lib/lvgl/examples/libs/tiny_ttf/lv_example_tiny_ttf_1.py
Normal file
16
sdk/lib/lvgl/examples/libs/tiny_ttf/lv_example_tiny_ttf_1.py
Normal file
@@ -0,0 +1,16 @@
|
||||
from ubuntu_font import ubuntu_font
|
||||
#
|
||||
# Load a font with Tiny_TTF
|
||||
#
|
||||
#Create style with the new font
|
||||
style = lv.style_t()
|
||||
style.init()
|
||||
font = lv.tiny_ttf_create_data(ubuntu_font, len(ubuntu_font), 30)
|
||||
style.set_text_font(font)
|
||||
style.set_text_align(lv.TEXT_ALIGN.CENTER)
|
||||
|
||||
# Create a label with the new style
|
||||
label = lv.label(lv.scr_act())
|
||||
label.add_style(style, 0)
|
||||
label.set_text("Hello world\nI'm a font created with Tiny TTF")
|
||||
label.center()
|
||||
22
sdk/lib/lvgl/examples/libs/tiny_ttf/lv_example_tiny_ttf_2.c
Normal file
22
sdk/lib/lvgl/examples/libs/tiny_ttf/lv_example_tiny_ttf_2.c
Normal file
@@ -0,0 +1,22 @@
|
||||
#include "../../lv_examples.h"
|
||||
#if LV_USE_TINY_TTF && LV_TINY_TTF_FILE_SUPPORT && LV_BUILD_EXAMPLES
|
||||
|
||||
/**
|
||||
* Load a font with Tiny_TTF from file
|
||||
*/
|
||||
void lv_example_tiny_ttf_2(void)
|
||||
{
|
||||
/*Create style with the new font*/
|
||||
static lv_style_t style;
|
||||
lv_style_init(&style);
|
||||
lv_font_t * font = lv_tiny_ttf_create_file("A:lvgl/examples/libs/tiny_ttf/Ubuntu-Medium.ttf", 30);
|
||||
lv_style_set_text_font(&style, 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\ncreated\nwith Tiny TTF");
|
||||
lv_obj_center(label);
|
||||
}
|
||||
#endif
|
||||
27
sdk/lib/lvgl/examples/libs/tiny_ttf/lv_example_tiny_ttf_2.py
Normal file
27
sdk/lib/lvgl/examples/libs/tiny_ttf/lv_example_tiny_ttf_2.py
Normal file
@@ -0,0 +1,27 @@
|
||||
import fs_driver
|
||||
|
||||
# needed for dynamic font loading
|
||||
fs_drv = lv.fs_drv_t()
|
||||
fs_driver.fs_register(fs_drv, 'S')
|
||||
|
||||
# get the directory in which the script is running
|
||||
try:
|
||||
script_path = __file__[:__file__.rfind('/')] if __file__.find('/') >= 0 else '.'
|
||||
except NameError:
|
||||
script_path = ''
|
||||
|
||||
#
|
||||
# Load a font with Tiny_TTF from file
|
||||
#
|
||||
# Create style with the new font
|
||||
style = lv.style_t()
|
||||
style.init()
|
||||
font = lv.tiny_ttf_create_file("S:" + script_path + "/Ubuntu-Medium.ttf", 30)
|
||||
style.set_text_font(font)
|
||||
style.set_text_align(lv.TEXT_ALIGN.CENTER)
|
||||
|
||||
# Create a label with the new style
|
||||
label = lv.label(lv.scr_act())
|
||||
label.add_style(style, 0)
|
||||
label.set_text("Hello world\nI'm a font created with Tiny TTF")
|
||||
label.center()
|
||||
11968
sdk/lib/lvgl/examples/libs/tiny_ttf/ubuntu_font.h
Normal file
11968
sdk/lib/lvgl/examples/libs/tiny_ttf/ubuntu_font.h
Normal file
File diff suppressed because it is too large
Load Diff
11964
sdk/lib/lvgl/examples/libs/tiny_ttf/ubuntu_font.py
Normal file
11964
sdk/lib/lvgl/examples/libs/tiny_ttf/ubuntu_font.py
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user