1 /** 2 * @file lv_freetype.h 3 * 4 */ 5 #ifndef LV_FREETYPE_H 6 #define LV_FREETYPE_H 7 8 #ifdef __cplusplus 9 extern "C" { 10 #endif 11 12 /********************* 13 * INCLUDES 14 *********************/ 15 #include "../../../lvgl.h" 16 #if LV_USE_FREETYPE 17 18 /********************* 19 * DEFINES 20 *********************/ 21 22 /********************** 23 * TYPEDEFS 24 **********************/ 25 typedef enum { 26 FT_FONT_STYLE_NORMAL = 0, 27 FT_FONT_STYLE_ITALIC = 1 << 0, 28 FT_FONT_STYLE_BOLD = 1 << 1 29 } LV_FT_FONT_STYLE; 30 31 typedef struct { 32 const char * name; /* The name of the font file */ 33 const void * mem; /* The pointer of the font file */ 34 size_t mem_size; /* The size of the memory */ 35 lv_font_t * font; /* point to lvgl font */ 36 uint16_t weight; /* font size */ 37 uint16_t style; /* font style */ 38 } lv_ft_info_t; 39 40 /********************** 41 * GLOBAL PROTOTYPES 42 **********************/ 43 44 /** 45 * init freetype library 46 * @param max_faces Maximum number of opened FT_Face objects managed by this cache instance. Use 0 for defaults. 47 * @param max_sizes Maximum number of opened FT_Size objects managed by this cache instance. Use 0 for defaults. 48 * @param max_bytes Maximum number of bytes to use for cached data nodes. Use 0 for defaults. 49 * Note that this value does not account for managed FT_Face and FT_Size objects. 50 * @return true on success, otherwise false. 51 */ 52 bool lv_freetype_init(uint16_t max_faces, uint16_t max_sizes, uint32_t max_bytes); 53 54 /** 55 * Destroy freetype library 56 */ 57 void lv_freetype_destroy(void); 58 59 /** 60 * Creates a font with info parameter specified. 61 * @param info See lv_ft_info_t for details. 62 * when success, lv_ft_info_t->font point to the font you created. 63 * @return true on success, otherwise false. 64 */ 65 bool lv_ft_font_init(lv_ft_info_t * info); 66 67 /** 68 * Destroy a font that has been created. 69 * @param font pointer to font. 70 */ 71 void lv_ft_font_destroy(lv_font_t * font); 72 73 /********************** 74 * MACROS 75 **********************/ 76 77 #endif /*LV_USE_FREETYPE*/ 78 79 #ifdef __cplusplus 80 } /* extern "C" */ 81 #endif 82 83 #endif /* LV_FREETYPE_H */ 84