initial commit
This commit is contained in:
commit
cff2a21efc
550 files changed
+154887
No files matched your search
@@ -0,0 +1,106 @@
|
||||
/**
|
||||
* @file lv_font_manager.h
|
||||
*
|
||||
*/
|
||||
#ifndef LV_FONT_MANAGER_H
|
||||
#define LV_FONT_MANAGER_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
|
||||
#include "../../misc/lv_types.h"
|
||||
|
||||
#if LV_USE_FONT_MANAGER
|
||||
|
||||
#if !LV_USE_FREETYPE
|
||||
#error "LV_USE_FONT_MANAGER requires LV_USE_FREETYPE"
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
typedef struct _lv_font_manager_t lv_font_manager_t;
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
/**
|
||||
* Create main font manager.
|
||||
* @param recycle_cache_size number of fonts that were recently deleted from the cache.
|
||||
* @return pointer to main font manager.
|
||||
*/
|
||||
lv_font_manager_t * lv_font_manager_create(uint32_t recycle_cache_size);
|
||||
|
||||
/**
|
||||
* Delete main font manager.
|
||||
* @param manager pointer to main font manager.
|
||||
* @return return true if the deletion was successful.
|
||||
*/
|
||||
bool lv_font_manager_delete(lv_font_manager_t * manager);
|
||||
|
||||
/**
|
||||
* Add the font file path.
|
||||
* @param manager pointer to main font manager.
|
||||
* @param name font name.
|
||||
* @param path font file path.
|
||||
*/
|
||||
void lv_font_manager_add_path(lv_font_manager_t * manager, const char * name, const char * path);
|
||||
|
||||
/**
|
||||
* Add the font file path with static memory.
|
||||
* @param manager pointer to main font manager.
|
||||
* @param name font name.
|
||||
* @param path font file path.
|
||||
*/
|
||||
void lv_font_manager_add_path_static(lv_font_manager_t * manager, const char * name, const char * path);
|
||||
|
||||
/**
|
||||
* Remove the font file path.
|
||||
* @param manager pointer to main font manager.
|
||||
* @param name font name.
|
||||
* @return return true if the remove was successful.
|
||||
*/
|
||||
bool lv_font_manager_remove_path(lv_font_manager_t * manager, const char * name);
|
||||
|
||||
/**
|
||||
* Create font.
|
||||
* @param manager pointer to main font manager.
|
||||
* @param font_family font family name.
|
||||
* @param render_mode font render mode, see lv_freetype_font_render_mode_t.
|
||||
* @param size font size.
|
||||
* @param style font style, see lv_freetype_font_style_t.
|
||||
* @return point to the created font
|
||||
*/
|
||||
lv_font_t * lv_font_manager_create_font(lv_font_manager_t * manager, const char * font_family, uint16_t render_mode,
|
||||
uint32_t size, uint16_t style);
|
||||
|
||||
/**
|
||||
* Delete font.
|
||||
* @param manager pointer to main font manager.
|
||||
* @param font point to the font.
|
||||
* @return return true if the deletion was successful.
|
||||
*/
|
||||
void lv_font_manager_delete_font(lv_font_manager_t * manager, lv_font_t * font);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
#endif /* LV_USE_FONT_MANAGER */
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* FONT_MANAGER_MANAGER_H */
|
||||
@@ -0,0 +1,78 @@
|
||||
/**
|
||||
* @file lv_font_manager_recycle.h
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LV_FONT_MANAGER_RECYCLE_H
|
||||
#define LV_FONT_MANAGER_RECYCLE_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
|
||||
#include "lv_font_manager_utils.h"
|
||||
|
||||
#if LV_USE_FONT_MANAGER
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
typedef struct _lv_font_manager_recycle_t lv_font_manager_recycle_t;
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
/**
|
||||
* Create font recycle manager.
|
||||
* @param max_size recycle size.
|
||||
* @return pointer to font recycle manager.
|
||||
*/
|
||||
lv_font_manager_recycle_t * lv_font_manager_recycle_create(uint32_t max_size);
|
||||
|
||||
/**
|
||||
* Delete font recycle manager.
|
||||
* @param manager pointer to font recycle manager.
|
||||
*/
|
||||
void lv_font_manager_recycle_delete(lv_font_manager_recycle_t * manager);
|
||||
|
||||
/**
|
||||
* Get a reusable font.
|
||||
* @param manager pointer to font recycle manager.
|
||||
* @param ft_info font info.
|
||||
* @return returns true on success.
|
||||
*/
|
||||
lv_font_t * lv_font_manager_recycle_get_reuse(lv_font_manager_recycle_t * manager, const lv_freetype_info_t * ft_info);
|
||||
|
||||
/**
|
||||
* Set fonts to be reused.
|
||||
* @param manager pointer to font recycle manager.
|
||||
* @param ft_info font info.
|
||||
*/
|
||||
void lv_font_manager_recycle_set_reuse(lv_font_manager_recycle_t * manager, lv_font_t * font,
|
||||
const lv_freetype_info_t * ft_info);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
#endif /* LV_USE_FONT_MANAGER */
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /* LV_FONT_MANAGER_RECYCLE_H */
|
||||
@@ -0,0 +1,59 @@
|
||||
/**
|
||||
* @file lv_font_manager_utils.h
|
||||
*
|
||||
*/
|
||||
#ifndef LV_FONT_MANAGER_UTILS_H
|
||||
#define LV_FONT_MANAGER_UTILS_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
|
||||
#include "../../misc/lv_types.h"
|
||||
|
||||
#if LV_USE_FONT_MANAGER
|
||||
|
||||
#include "../../libs/freetype/lv_freetype.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
typedef struct {
|
||||
const char * name;
|
||||
lv_freetype_font_render_mode_t render_mode;
|
||||
lv_freetype_font_style_t style;
|
||||
uint32_t size;
|
||||
} lv_freetype_info_t;
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
/**
|
||||
* Compare font information.
|
||||
* @param ft_info_1 font information 1.
|
||||
* @param ft_info_2 font information 2.
|
||||
* @return return true if the fonts are equal.
|
||||
*/
|
||||
bool lv_freetype_info_is_equal(const lv_freetype_info_t * ft_info_1, const lv_freetype_info_t * ft_info_2);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
#endif /*LV_USE_FONT_MANAGER*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /* LV_FONT_MANAGER_UTILS_H */
|
||||
Reference in new issue
Block a user