FreeType support(支持FreeType)

查看原文

Interface to FreeType to generate font bitmaps run time.

FreeType 的接口以生成字体位图运行时。

Install FreeType(安装 FreeType)

查看原文

  • Download Freetype from here

  • make

  • sudo make install

  • 这里下载Freetype

  • make

  • sudo make install

Add FreeType to your project(将 FreeType 添加到项目中)

查看原文

  • 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)

  • 添加包含路径:/usr/include/freetype2(对于 GCC:-I/usr/include/freetype2 -L/usr/local/lib

  • 添加库:freetype(对于 GCC:-L /usr/local/lib -lfreetype)

Usage(用法)

查看原文

Enable LV_USE_FREETYPE in lv_conf.h.

See the examples below.

Note that, 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.

lv_conf.h 中启用 LV_USE_FREETYPE

参见下面的示例。

注意,FreeType 扩展不使用 LVGL 的文件系统。 您可以像往常一样在操作系统或平台上简单地传递字体的路径。

Learn more(深入学习)

查看原文

  • FreeType 教程

  • LVGL 的 [字体界面](https://docs.lvgl.io/v7/en/html/overview /font.html#add-a-new-font-engine)

API

Enums

enum LV_FT_FONT_STYLE

Values:

enumerator FT_FONT_STYLE_NORMAL
enumerator FT_FONT_STYLE_ITALIC
enumerator FT_FONT_STYLE_BOLD

Functions

bool lv_freetype_init(uint16_t max_faces, uint16_t max_sizes, uint32_t max_bytes)

init freetype library

参数
  • max_faces -- Maximum number of opened FT_Face objects managed by this cache instance. Use 0 for defaults.

  • max_sizes -- Maximum number of opened FT_Size objects managed by this cache instance. Use 0 for defaults.

  • 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.

返回

true on success, otherwise false.

void lv_freetype_destroy(void)

Destroy freetype library

bool lv_ft_font_init(lv_ft_info_t *info)

Creates a font with info parameter specified.

参数

info -- See lv_ft_info_t for details. when success, lv_ft_info_t->font point to the font you created.

返回

true on success, otherwise false.

void lv_ft_font_destroy(lv_font_t *font)

Destroy a font that has been created.

参数

font -- pointer to font.

struct lv_ft_info_t

Public Members

const char *name
lv_font_t *font
uint16_t weight
uint16_t style