acid-drop- Hacking the planet from a LilyGo T-Deck using custom firmware |
git clone git://git.acid.vegas/acid-drop.git |
Log | Files | Refs | Archive | README | LICENSE |
freetype.md (2539B)
1 ```eval_rst 2 .. include:: /header.rst 3 :github_url: |github_link_base|/libs/freetype.md 4 ``` 5 6 # FreeType support 7 Interface to [FreeType](https://www.freetype.org/) to generate font bitmaps run time. 8 9 ## Install FreeType 10 - Download Freetype from [here](https://sourceforge.net/projects/freetype/files/) 11 - `make` 12 - `sudo make install` 13 14 ## Add FreeType to your project 15 - Add include path: `/usr/include/freetype2` (for GCC: `-I/usr/include/freetype2 -L/usr/local/lib`) 16 - Add library: `freetype` (for GCC: `-L/usr/local/lib -lfreetype`) 17 18 ## Usage 19 Enable `LV_USE_FREETYPE` in `lv_conf.h`. 20 21 To cache the glyphs from the opened fonts, set `LV_FREETYPE_CACHE_SIZE >= 0` and then use the following macros for detailed configuration: 22 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. 23 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. 24 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. 25 26 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. 27 28 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. 29 30 Font style supports bold and italic, you can use the following macros to set: 31 1. `FT_FONT_STYLE_NORMAL`:default style. 32 1. `FT_FONT_STYLE_ITALIC`:Italic style 33 1. `FT_FONT_STYLE_BOLD`:bold style 34 35 They can be combined.eg:`FT_FONT_STYLE_BOLD | FT_FONT_STYLE_ITALIC`. 36 37 Note that, the FreeType extension doesn't use LVGL's file system. 38 You can simply pass the path to the font as usual on your operating system or platform. 39 40 ## Example 41 ```eval_rst 42 .. include:: ../../examples/libs/freetype/index.rst 43 ``` 44 45 46 ## Learn more 47 - FreeType [tutorial](https://www.freetype.org/freetype2/docs/tutorial/step1.html) 48 - LVGL's [font interface](https://docs.lvgl.io/v7/en/html/overview/font.html#add-a-new-font-engine) 49 50 51 ## API 52 ```eval_rst 53 .. doxygenfile:: lv_freetype.h 54 :project: lvgl 55 ```