lv_freetype.h

Defines

LV_FREETYPE_F26DOT6_TO_INT(x)
LV_FREETYPE_F26DOT6_TO_FLOAT(x)
FT_FONT_STYLE_NORMAL
FT_FONT_STYLE_ITALIC
FT_FONT_STYLE_BOLD

Typedefs

typedef lv_freetype_font_style_t LV_FT_FONT_STYLE
typedef void *lv_freetype_outline_t

Enums

enum lv_freetype_font_style_t

Values:

enumerator LV_FREETYPE_FONT_STYLE_NORMAL
enumerator LV_FREETYPE_FONT_STYLE_ITALIC
enumerator LV_FREETYPE_FONT_STYLE_BOLD
enum lv_freetype_font_render_mode_t

Values:

enumerator LV_FREETYPE_FONT_RENDER_MODE_BITMAP
enumerator LV_FREETYPE_FONT_RENDER_MODE_OUTLINE
enum lv_freetype_outline_type_t

Values:

enumerator LV_FREETYPE_OUTLINE_END
enumerator LV_FREETYPE_OUTLINE_MOVE_TO
enumerator LV_FREETYPE_OUTLINE_LINE_TO
enumerator LV_FREETYPE_OUTLINE_CUBIC_TO
enumerator LV_FREETYPE_OUTLINE_CONIC_TO

Functions

lv_result_t lv_freetype_init(uint32_t max_glyph_cnt)

Initialize the freetype library.

Returns:

LV_RESULT_OK on success, otherwise LV_RESULT_INVALID.

void lv_freetype_uninit(void)

Uninitialize the freetype library

lv_font_t *lv_freetype_font_create(const char *pathname, lv_freetype_font_render_mode_t render_mode, uint32_t size, lv_freetype_font_style_t style)

Create a freetype font.

Parameters:
  • pathname -- font file path.

  • render_mode -- font render mode(see @lv_freetype_font_render_mode_t for details).

  • size -- font size.

  • style -- font style(see lv_freetype_font_style_t for details).

Returns:

Created font, or NULL on failure.

void lv_freetype_font_delete(lv_font_t *font)

Delete a freetype font.

Parameters:

font -- freetype font to be deleted.

void lv_freetype_outline_add_event(lv_event_cb_t event_cb, lv_event_code_t filter, void *user_data)

Register a callback function to generate outlines for FreeType fonts.

Parameters:
  • cb -- The callback function to be registered.

  • user_data -- User data to be passed to the callback function.

Returns:

The ID of the registered callback function, or a negative value on failure.

uint32_t lv_freetype_outline_get_scale(const lv_font_t *font)

Get the scale of a FreeType font.

Parameters:

font -- The FreeType font to get the scale of.

Returns:

The scale of the FreeType font.

bool lv_freetype_is_outline_font(const lv_font_t *font)

Check if the font is an outline font.

Parameters:

font -- The FreeType font.

Returns:

Is outline font on success, otherwise false.