refact(freetype): clean up global variables and infrequent functions (#3782)

Signed-off-by: pengyiqiang <pengyiqiang@xiaomi.com>
Co-authored-by: pengyiqiang <pengyiqiang@xiaomi.com>
This commit is contained in:
_VIFEXTech
2022-11-24 19:27:38 +08:00
committed by GitHub
parent ac763346c8
commit e7da3b247e
11 changed files with 1732 additions and 603 deletions
+14 -13
View File
@@ -956,19 +956,20 @@ menu "LVGL configuration"
if LV_USE_FREETYPE
menu "FreeType cache config"
config LV_FREETYPE_CACHE_SIZE
int "Memory used by FreeType to cache characters [bytes] (-1: no caching)"
default 16384
if LV_FREETYPE_CACHE_SIZE >= 0
config LV_FREETYPE_SBIT_CACHE
bool "enable sbit cache"
default n
config LV_FREETYPE_CACHE_FT_FACES
int "The maximum number of FT_Face(0: use defaults)"
default 0
config LV_FREETYPE_CACHE_FT_SIZES
int "The maximum number of FT_Size(0: use defaults)"
default 0
endif
int "Memory used by FreeType to cache characters [bytes]"
default 65535
config LV_FREETYPE_USE_LVGL_PORT
bool "Let FreeType to use LVGL memory and file porting"
default n
config LV_FREETYPE_SBIT_CACHE
bool "enable sbit cache"
default n
config LV_FREETYPE_CACHE_FT_FACES
int "The maximum number of FT_Face(0: use defaults)"
default 4
config LV_FREETYPE_CACHE_FT_SIZES
int "The maximum number of FT_Size(0: use defaults)"
default 4
endmenu
endif
+54 -19
View File
@@ -2,37 +2,72 @@
# FreeType support
Interface to [FreeType](https://www.freetype.org/) to generate font bitmaps run time.
## Install FreeType
- Download Freetype from [here](https://sourceforge.net/projects/freetype/files/)
## Add FreeType to your project
First, Download FreeType from [here](https://sourceforge.net/projects/freetype/files/).
There are two ways to use FreeType:
### For UNIX
For UNIX systems, it is recommended to use the way of compiling and installing libraries.
- Enter the FreeType source code directory.
- `make`
- `sudo make install`
## Add FreeType to your project
- Add include path: `/usr/include/freetype2` (for GCC: `-I/usr/include/freetype2 -L/usr/local/lib`)
- Add library: `freetype` (for GCC: `-L/usr/local/lib -lfreetype`)
- Link library: `freetype` (for GCC: `-L/usr/local/lib -lfreetype`)
### For Embedded Devices
For embedded devices, it is more recommended to use the FreeType configuration file provided by LVGL, which only includes the most commonly used functions, which is very meaningful for saving limited FLASH space.
- Copy the FreeType source code to your project directory.
- Refer to the following `Makefile` for configuration:
```make
# FreeType custom configuration header file
CFLAGS += -DFT2_BUILD_LIBRARY
CFLAGS += -DFT_CONFIG_MODULES_H=<lvgl/src/libs/freetype/ftmodule.h>
CFLAGS += -DFT_CONFIG_OPTIONS_H=<lvgl/src/libs/freetype/ftoption.h>
# FreeType include path
CFLAGS += -Ifreetype/include
# FreeType C source file
FT_CSRCS += freetype/src/base/ftbase.c
FT_CSRCS += freetype/src/base/ftbitmap.c
FT_CSRCS += freetype/src/base/ftdebug.c
FT_CSRCS += freetype/src/base/ftglyph.c
FT_CSRCS += freetype/src/base/ftinit.c
FT_CSRCS += freetype/src/cache/ftcache.c
FT_CSRCS += freetype/src/gzip/ftgzip.c
FT_CSRCS += freetype/src/sfnt/sfnt.c
FT_CSRCS += freetype/src/smooth/smooth.c
FT_CSRCS += freetype/src/truetype/truetype.c
CSRCS += $(FT_CSRCS)
```
## Usage
Enable `LV_USE_FREETYPE` in `lv_conf.h`.
To cache the glyphs from the opened fonts, set `LV_FREETYPE_CACHE_SIZE >= 0` and then use the following macros for detailed configuration:
1. `LV_FREETYPE_CACHE_SIZE`:maximum memory(bytes) used to cache font bitmap, outline, character maps, etc. 0 means use the system default value, less than 0 means disable cache. Note: that this value does not account for managed FT_Face and FT_Size objects.
1. `LV_FREETYPE_CACHE_FT_FACES`:maximum number of opened FT_Face objects managed by this cache instance.0 means use the system default value. Only useful when LV_FREETYPE_CACHE_SIZE >= 0.
1. `LV_FREETYPE_CACHE_FT_SIZES`:maximum number of opened FT_Size objects managed by this cache instance. 0 means use the system default value. Only useful when LV_FREETYPE_CACHE_SIZE >= 0.
Cache configuration:
- `LV_FREETYPE_CACHE_SIZE` - Maximum memory(Bytes) used to cache font bitmap, outline, character maps, etc. **Note:** This value does not include the memory used by 'FT_Face' and 'FT_Size' objects
- `LV_FREETYPE_CACHE_FT_FACES` - Maximum open number of `FT_Face` objects.
- `LV_FREETYPE_CACHE_FT_SIZES` - Maximum open number of `FT_Size` objects.
When you are sure that all the used font sizes will not be greater than 256, you can enable `LV_FREETYPE_SBIT_CACHE`, which is much more memory efficient for small bitmaps.
You can use `lv_ft_font_init()` to create FreeType fonts. It returns `true` to indicate success, at the same time, the `font` member of `lv_ft_info_t` will be filled with a pointer to an LVGL font, and you can use it like any LVGL font.
Font style supports bold and italic, you can use the following macros to set:
1. `FT_FONT_STYLE_NORMAL`:default style.
1. `FT_FONT_STYLE_ITALIC`:Italic style
1. `FT_FONT_STYLE_BOLD`:bold style
They can be combined.eg:`FT_FONT_STYLE_BOLD | FT_FONT_STYLE_ITALIC`.
Note that, the FreeType extension doesn't use LVGL's file system.
By default, the FreeType extension doesn't use LVGL's file system.
You can simply pass the path to the font as usual on your operating system or platform.
If you want FreeType to use lvgl's memory allocation and file system interface, you can enable `LV_FREETYPE_USE_LVGL_PORT` in `lv_conf.h`, convenient for unified management.
The font style supports *Italic* and **Bold** fonts processed by software, and can be set with reference to the following values:
- `LV_FREETYPE_FONT_STYLE_NORMAL` - Default style.
- `LV_FREETYPE_FONT_STYLE_ITALIC` - Italic style.
- `LV_FREETYPE_FONT_STYLE_BOLD` - Bold style.
They can be combined.eg: `LV_FREETYPE_FONT_STYLE_BOLD | LV_FREETYPE_FONT_STYLE_ITALIC`.
Use the `lv_freetype_font_create()` function to create a font. To delete a font, use `lv_freetype_font_del()`. For more detailed usage, please refer to example code.
## Example
```eval_rst
.. include:: ../../examples/libs/freetype/index.rst
+14 -9
View File
@@ -2,26 +2,31 @@
#if LV_BUILD_EXAMPLES
#if LV_USE_FREETYPE
#if LV_FREETYPE_USE_LVGL_PORT
#define PATH_PREFIX "A:"
#else
#define PATH_PREFIX "./"
#endif
/**
* 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/Lato-Regular.ttf";
info.weight = 24;
info.style = FT_FONT_STYLE_NORMAL;
info.mem = NULL;
if(!lv_ft_font_init(&info)) {
LV_LOG_ERROR("create failed.");
lv_font_t * font = lv_freetype_font_create(PATH_PREFIX "lvgl/examples/libs/freetype/Lato-Regular.ttf",
24,
LV_FREETYPE_FONT_STYLE_NORMAL);
if(!font) {
LV_LOG_ERROR("freetype font create failed.");
return;
}
/*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_font(&style, font);
lv_style_set_text_align(&style, LV_TEXT_ALIGN_CENTER);
/*Create a label with the new style*/
@@ -3,16 +3,12 @@ import lvgl as lv
import display_driver
import fs_driver
info = lv.ft_info_t()
info.name ="./Lato-Regular.ttf"
info.weight = 24
info.style = lv.FT_FONT_STYLE.NORMAL
info.font_init()
font = lv.freetype_font_create("./Lato-Regular.ttf", 24, lv.FREETYPE_FONT_STYLE.NORMAL)
# Create style with the new font
style = lv.style_t()
style.init()
style.set_text_font(info.font)
style.set_text_font(font)
style.set_text_align(lv.TEXT_ALIGN.CENTER)
# Create a label with the new style
+15 -12
View File
@@ -636,18 +636,21 @@
/*FreeType library*/
#define LV_USE_FREETYPE 0
#if LV_USE_FREETYPE
/*Memory used by FreeType to cache characters [bytes] (-1: no caching)*/
#define LV_FREETYPE_CACHE_SIZE (16 * 1024)
#if LV_FREETYPE_CACHE_SIZE >= 0
/* 1: bitmap cache use the sbit cache, 0:bitmap cache use the image cache. */
/* sbit cache:it is much more memory efficient for small bitmaps(font size < 256) */
/* if font size >= 256, must be configured as image cache */
#define LV_FREETYPE_SBIT_CACHE 0
/* Maximum number of opened FT_Face/FT_Size objects managed by this cache instance. */
/* (0:use system defaults) */
#define LV_FREETYPE_CACHE_FT_FACES 0
#define LV_FREETYPE_CACHE_FT_SIZES 0
#endif
/*Memory used by FreeType to cache characters [bytes]*/
#define LV_FREETYPE_CACHE_SIZE (64 * 1024)
/*Let FreeType to use LVGL memory and file porting*/
#define LV_FREETYPE_USE_LVGL_PORT 0
/* 1: bitmap cache use the sbit cache, 0:bitmap cache use the image cache. */
/* sbit cache:it is much more memory efficient for small bitmaps(font size < 256) */
/* if font size >= 256, must be configured as image cache */
#define LV_FREETYPE_SBIT_CACHE 0
/* Maximum number of opened FT_Face/FT_Size objects managed by this cache instance. */
/* (0:use system defaults) */
#define LV_FREETYPE_CACHE_FT_FACES 4
#define LV_FREETYPE_CACHE_FT_SIZES 4
#endif
/* Built-in TTF decoder */
+33
View File
@@ -0,0 +1,33 @@
/*
* This file registers the FreeType modules compiled into the library.
*
* If you use GNU make, this file IS NOT USED! Instead, it is created in
* the objects directory (normally `<topdir>/objs/`) based on information
* from `<topdir>/modules.cfg`.
*
* Please read `docs/INSTALL.ANY` and `docs/CUSTOMIZE` how to compile
* FreeType without GNU make.
*
*/
/* FT_USE_MODULE( FT_Module_Class, autofit_module_class ) */
FT_USE_MODULE(FT_Driver_ClassRec, tt_driver_class)
/* FT_USE_MODULE( FT_Driver_ClassRec, t1_driver_class ) */
/* FT_USE_MODULE( FT_Driver_ClassRec, cff_driver_class ) */
/* FT_USE_MODULE( FT_Driver_ClassRec, t1cid_driver_class ) */
/* FT_USE_MODULE( FT_Driver_ClassRec, pfr_driver_class ) */
/* FT_USE_MODULE( FT_Driver_ClassRec, t42_driver_class ) */
/* FT_USE_MODULE( FT_Driver_ClassRec, winfnt_driver_class ) */
/* FT_USE_MODULE( FT_Driver_ClassRec, pcf_driver_class ) */
/* FT_USE_MODULE( FT_Driver_ClassRec, bdf_driver_class ) */
/* FT_USE_MODULE( FT_Module_Class, psaux_module_class ) */
/* FT_USE_MODULE( FT_Module_Class, psnames_module_class ) */
/* FT_USE_MODULE( FT_Module_Class, pshinter_module_class ) */
FT_USE_MODULE(FT_Module_Class, sfnt_module_class)
FT_USE_MODULE(FT_Renderer_Class, ft_smooth_renderer_class)
/* FT_USE_MODULE( FT_Renderer_Class, ft_raster1_renderer_class ) */
/* FT_USE_MODULE( FT_Renderer_Class, ft_sdf_renderer_class ) */
/* FT_USE_MODULE( FT_Renderer_Class, ft_bitmap_sdf_renderer_class ) */
/* FT_USE_MODULE( FT_Renderer_Class, ft_svg_renderer_class ) */
/* EOF */
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+19 -26
View File
@@ -22,53 +22,46 @@ extern "C" {
/**********************
* TYPEDEFS
**********************/
typedef enum {
FT_FONT_STYLE_NORMAL = 0,
FT_FONT_STYLE_ITALIC = 1 << 0,
FT_FONT_STYLE_BOLD = 1 << 1
} LV_FT_FONT_STYLE;
typedef struct {
const char * name; /* The name of the font file */
const void * mem; /* The pointer of the font file */
size_t mem_size; /* The size of the memory */
lv_font_t * font; /* point to lvgl font */
uint16_t weight; /* font size */
uint16_t style; /* font style */
} lv_ft_info_t;
typedef enum {
LV_FREETYPE_FONT_STYLE_NORMAL = 0,
LV_FREETYPE_FONT_STYLE_ITALIC = 1 << 0,
LV_FREETYPE_FONT_STYLE_BOLD = 1 << 1
} lv_freetype_font_style_t;
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* init freetype library
* Initialize the freetype library.
* @param max_faces Maximum number of opened FT_Face objects managed by this cache instance. Use 0 for defaults.
* @param max_sizes Maximum number of opened FT_Size objects managed by this cache instance. Use 0 for defaults.
* @param max_bytes Maximum number of bytes to use for cached data nodes. Use 0 for defaults.
* Note that this value does not account for managed FT_Face and FT_Size objects.
* @return true on success, otherwise false.
* @return LV_RES_OK on success, otherwise LV_RES_INV.
*/
bool lv_freetype_init(uint16_t max_faces, uint16_t max_sizes, uint32_t max_bytes);
lv_res_t lv_freetype_init(uint16_t max_faces, uint16_t max_sizes, uint32_t max_bytes);
/**
* Destroy freetype library
* Uninitialize the freetype library
*/
void lv_freetype_destroy(void);
void lv_freetype_uninit(void);
/**
* Creates a font with info parameter specified.
* @param info See lv_ft_info_t for details.
* when success, lv_ft_info_t->font point to the font you created.
* @return true on success, otherwise false.
* Create a freetype font.
* @param pathname font file path.
* @param size font size.
* @param style font style(see lv_freetype_font_style_t for details).
* @return Created font, or NULL on failure.
*/
bool lv_ft_font_init(lv_ft_info_t * info);
lv_font_t * lv_freetype_font_create(const char * pathname, uint16_t size, uint16_t style);
/**
* Destroy a font that has been created.
* @param font pointer to font.
* Delete a freetype font.
* @param font freetype font to be deleted.
*/
void lv_ft_font_destroy(lv_font_t * font);
void lv_freetype_font_del(lv_font_t * font);
/**********************
* MACROS
+292
View File
@@ -0,0 +1,292 @@
/**
* @file lv_ftsystem.c
*
*/
/*********************
* INCLUDES
*********************/
#include "../../../lvgl.h"
#if LV_USE_FREETYPE && LV_FREETYPE_USE_LVGL_PORT
#include <ft2build.h>
#include FT_CONFIG_CONFIG_H
#include <freetype/internal/ftdebug.h>
#include <freetype/internal/ftstream.h>
#include <freetype/ftsystem.h>
#include <freetype/fterrors.h>
#include <freetype/fttypes.h>
/*********************
* DEFINES
*********************/
/* The macro FT_COMPONENT is used in trace mode. It is an implicit
* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log
* messages during execution.
*/
#undef FT_COMPONENT
#define FT_COMPONENT io
/* We use the macro STREAM_FILE for convenience to extract the */
/* system-specific stream handle from a given FreeType stream object */
#define STREAM_FILE( stream ) ( (lv_fs_file_t*)stream->descriptor.pointer )
/**********************
* TYPEDEFS
**********************/
/**********************
* STATIC PROTOTYPES
**********************/
FT_CALLBACK_DEF(unsigned long)
ft_lv_fs_stream_io(FT_Stream stream,
unsigned long offset,
unsigned char * buffer,
unsigned long count);
FT_CALLBACK_DEF(void)
ft_lv_fs_stream_close(FT_Stream stream);
FT_CALLBACK_DEF(void *)
ft_alloc(FT_Memory memory,
long size);
FT_CALLBACK_DEF(void *)
ft_realloc(FT_Memory memory,
long cur_size,
long new_size,
void * block);
FT_CALLBACK_DEF(void)
ft_free(FT_Memory memory,
void * block);
/**********************
* STATIC VARIABLES
**********************/
/**********************
* MACROS
**********************/
#ifdef FT_DEBUG_MEMORY
extern FT_Int
ft_mem_debug_init(FT_Memory memory);
extern void
ft_mem_debug_done(FT_Memory memory);
#endif
/**********************
* GLOBAL FUNCTIONS
**********************/
#ifndef FT_CONFIG_OPTION_DISABLE_STREAM_SUPPORT
/* documentation is in ftstream.h */
FT_BASE_DEF(FT_Error)
FT_Stream_Open(FT_Stream stream,
const char * filepathname)
{
lv_fs_file_t file;
if(!stream)
return FT_THROW(Invalid_Stream_Handle);
stream->descriptor.pointer = NULL;
stream->pathname.pointer = (char *)filepathname;
stream->base = NULL;
stream->pos = 0;
stream->read = NULL;
stream->close = NULL;
lv_fs_res_t res = lv_fs_open(&file, filepathname, LV_FS_MODE_RD);
if(res != LV_FS_RES_OK) {
FT_ERROR(("FT_Stream_Open:"
" could not open `%s'\n", filepathname));
return FT_THROW(Cannot_Open_Resource);
}
lv_fs_seek(&file, 0, LV_FS_SEEK_END);
uint32_t pos;
res = lv_fs_tell(&file, &pos);
if(res != LV_FS_RES_OK) {
FT_ERROR(("FT_Stream_Open:"));
FT_ERROR((" opened `%s' but zero-sized\n", filepathname));
lv_fs_close(&file);
return FT_THROW(Cannot_Open_Stream);
}
stream->size = pos;
lv_fs_seek(&file, 0, LV_FS_SEEK_SET);
lv_fs_file_t * file_p = lv_malloc(sizeof(lv_fs_file_t));
LV_ASSERT_MALLOC(file_p);
if(!file_p) {
FT_ERROR(("FT_Stream_Open: malloc failed for file_p"));
lv_fs_close(&file);
return FT_THROW(Cannot_Open_Stream);
}
*file_p = file;
stream->descriptor.pointer = file_p;
stream->read = ft_lv_fs_stream_io;
stream->close = ft_lv_fs_stream_close;
FT_TRACE1(("FT_Stream_Open:"));
FT_TRACE1((" opened `%s' (%ld bytes) successfully\n",
filepathname, stream->size));
return FT_Err_Ok;
}
#endif /* !FT_CONFIG_OPTION_DISABLE_STREAM_SUPPORT */
/* documentation is in ftobjs.h */
FT_BASE_DEF(FT_Memory)
FT_New_Memory(void)
{
FT_Memory memory;
memory = (FT_Memory)lv_malloc(sizeof(*memory));
if(memory) {
memory->user = NULL;
memory->alloc = ft_alloc;
memory->realloc = ft_realloc;
memory->free = ft_free;
#ifdef FT_DEBUG_MEMORY
ft_mem_debug_init(memory);
#endif
}
return memory;
}
/* documentation is in ftobjs.h */
FT_BASE_DEF(void)
FT_Done_Memory(FT_Memory memory)
{
#ifdef FT_DEBUG_MEMORY
ft_mem_debug_done(memory);
#endif
lv_free(memory);
}
/**********************
* STATIC FUNCTIONS
**********************/
/**
* The memory allocation function.
* @param memory A pointer to the memory object.
* @param size The requested size in bytes.
* @return The address of newly allocated block.
*/
FT_CALLBACK_DEF(void *)
ft_alloc(FT_Memory memory,
long size)
{
FT_UNUSED(memory);
return lv_malloc((size_t)size);
}
/**
* The memory reallocation function.
* @param memory A pointer to the memory object.
* @param cur_size The current size of the allocated memory block.
* @param new_size The newly requested size in bytes.
* @param block The current address of the block in memory.
* @return The address of the reallocated memory block.
*/
FT_CALLBACK_DEF(void *)
ft_realloc(FT_Memory memory,
long cur_size,
long new_size,
void * block)
{
FT_UNUSED(memory);
FT_UNUSED(cur_size);
return lv_realloc(block, (size_t)new_size);
}
/**
* The memory release function.
* @param memory A pointer to the memory object.
* @param block The address of block in memory to be freed.
*/
FT_CALLBACK_DEF(void)
ft_free(FT_Memory memory,
void * block)
{
FT_UNUSED(memory);
lv_free(block);
}
#ifndef FT_CONFIG_OPTION_DISABLE_STREAM_SUPPORT
/**
* The function to close a stream.
* @param stream A pointer to the stream object.
*/
FT_CALLBACK_DEF(void)
ft_lv_fs_stream_close(FT_Stream stream)
{
lv_fs_file_t * file_p = STREAM_FILE(stream);
lv_fs_close(file_p);
lv_free(file_p);
stream->descriptor.pointer = NULL;
stream->size = 0;
stream->base = NULL;
}
/**
* The function to open a stream.
* @param stream A pointer to the stream object.
* @param offset The position in the data stream to start reading.
* @param buffer The address of buffer to store the read data.
* @param count The number of bytes to read from the stream.
* @return The number of bytes actually read. If `count' is zero (this is,
* the function is used for seeking), a non-zero return value
* indicates an error.
*/
FT_CALLBACK_DEF(unsigned long)
ft_lv_fs_stream_io(FT_Stream stream,
unsigned long offset,
unsigned char * buffer,
unsigned long count)
{
lv_fs_file_t * file_p;
if(!count && offset > stream->size)
return 1;
file_p = STREAM_FILE(stream);
if(stream->pos != offset)
lv_fs_seek(file_p, (long)offset, LV_FS_SEEK_SET);
if(count == 0)
return 0;
uint32_t br;
lv_fs_res_t res = lv_fs_read(file_p, buffer, count, &br);
return res == LV_FS_RES_OK ? br : 0;
}
#endif /* !FT_CONFIG_OPTION_DISABLE_STREAM_SUPPORT */
#endif/*LV_FREETYPE_USE_LV_FTSYSTEM*/
+35 -26
View File
@@ -2162,40 +2162,49 @@
#endif
#endif
#if LV_USE_FREETYPE
/*Memory used by FreeType to cache characters [bytes] (-1: no caching)*/
/*Memory used by FreeType to cache characters [bytes]*/
#ifndef LV_FREETYPE_CACHE_SIZE
#ifdef CONFIG_LV_FREETYPE_CACHE_SIZE
#define LV_FREETYPE_CACHE_SIZE CONFIG_LV_FREETYPE_CACHE_SIZE
#else
#define LV_FREETYPE_CACHE_SIZE (16 * 1024)
#define LV_FREETYPE_CACHE_SIZE (64 * 1024)
#endif
#endif
#if LV_FREETYPE_CACHE_SIZE >= 0
/* 1: bitmap cache use the sbit cache, 0:bitmap cache use the image cache. */
/* sbit cache:it is much more memory efficient for small bitmaps(font size < 256) */
/* if font size >= 256, must be configured as image cache */
#ifndef LV_FREETYPE_SBIT_CACHE
#ifdef CONFIG_LV_FREETYPE_SBIT_CACHE
#define LV_FREETYPE_SBIT_CACHE CONFIG_LV_FREETYPE_SBIT_CACHE
#else
#define LV_FREETYPE_SBIT_CACHE 0
#endif
/*Let FreeType to use LVGL memory and file porting*/
#ifndef LV_FREETYPE_USE_LVGL_PORT
#ifdef CONFIG_LV_FREETYPE_USE_LVGL_PORT
#define LV_FREETYPE_USE_LVGL_PORT CONFIG_LV_FREETYPE_USE_LVGL_PORT
#else
#define LV_FREETYPE_USE_LVGL_PORT 0
#endif
/* Maximum number of opened FT_Face/FT_Size objects managed by this cache instance. */
/* (0:use system defaults) */
#ifndef LV_FREETYPE_CACHE_FT_FACES
#ifdef CONFIG_LV_FREETYPE_CACHE_FT_FACES
#define LV_FREETYPE_CACHE_FT_FACES CONFIG_LV_FREETYPE_CACHE_FT_FACES
#else
#define LV_FREETYPE_CACHE_FT_FACES 0
#endif
#endif
/* 1: bitmap cache use the sbit cache, 0:bitmap cache use the image cache. */
/* sbit cache:it is much more memory efficient for small bitmaps(font size < 256) */
/* if font size >= 256, must be configured as image cache */
#ifndef LV_FREETYPE_SBIT_CACHE
#ifdef CONFIG_LV_FREETYPE_SBIT_CACHE
#define LV_FREETYPE_SBIT_CACHE CONFIG_LV_FREETYPE_SBIT_CACHE
#else
#define LV_FREETYPE_SBIT_CACHE 0
#endif
#ifndef LV_FREETYPE_CACHE_FT_SIZES
#ifdef CONFIG_LV_FREETYPE_CACHE_FT_SIZES
#define LV_FREETYPE_CACHE_FT_SIZES CONFIG_LV_FREETYPE_CACHE_FT_SIZES
#else
#define LV_FREETYPE_CACHE_FT_SIZES 0
#endif
#endif
/* Maximum number of opened FT_Face/FT_Size objects managed by this cache instance. */
/* (0:use system defaults) */
#ifndef LV_FREETYPE_CACHE_FT_FACES
#ifdef CONFIG_LV_FREETYPE_CACHE_FT_FACES
#define LV_FREETYPE_CACHE_FT_FACES CONFIG_LV_FREETYPE_CACHE_FT_FACES
#else
#define LV_FREETYPE_CACHE_FT_FACES 4
#endif
#endif
#ifndef LV_FREETYPE_CACHE_FT_SIZES
#ifdef CONFIG_LV_FREETYPE_CACHE_FT_SIZES
#define LV_FREETYPE_CACHE_FT_SIZES CONFIG_LV_FREETYPE_CACHE_FT_SIZES
#else
#define LV_FREETYPE_CACHE_FT_SIZES 4
#endif
#endif
#endif