lv_font_fmt_txt.h

Enums

enum lv_font_fmt_txt_cmap_type_t

Format of font character map.

Values:

enumerator LV_FONT_FMT_TXT_CMAP_FORMAT0_FULL
enumerator LV_FONT_FMT_TXT_CMAP_SPARSE_FULL
enumerator LV_FONT_FMT_TXT_CMAP_FORMAT0_TINY
enumerator LV_FONT_FMT_TXT_CMAP_SPARSE_TINY
enum lv_font_fmt_txt_bitmap_format_t

Bitmap formats

Values:

enumerator LV_FONT_FMT_TXT_PLAIN
enumerator LV_FONT_FMT_TXT_COMPRESSED
enumerator LV_FONT_FMT_TXT_COMPRESSED_NO_PREFILTER
enumerator LV_FONT_FMT_PLAIN_ALIGNED

Functions

const void *lv_font_get_bitmap_fmt_txt(lv_font_glyph_dsc_t *g_dsc, lv_draw_buf_t *draw_buf)

Used as get_glyph_bitmap callback in lvgl's native font format if the font is uncompressed.

Parameters:
  • g_dsc – the glyph descriptor including which font to use, which supply the glyph_index and format.

  • draw_buf – a draw buffer that can be used to store the bitmap of the glyph, it's OK not to use it.

Returns:

pointer to an A8 bitmap (not necessarily bitmap_out) or NULL if unicode_letter not found

bool lv_font_get_glyph_dsc_fmt_txt(const lv_font_t *font, lv_font_glyph_dsc_t *dsc_out, uint32_t unicode_letter, uint32_t unicode_letter_next)

Used as get_glyph_dsc callback in lvgl's native font format if the font is uncompressed.

Parameters:
  • font – pointer to font

  • dsc_out – store the result descriptor here

  • unicode_letter – a UNICODE letter code

  • unicode_letter_next – the unicode letter succeeding the letter under test

Returns:

true: descriptor is successfully loaded into dsc_out. false: the letter was not found, no data is loaded to dsc_out

struct lv_font_fmt_txt_glyph_dsc_t
#include <lv_font_fmt_txt.h>

This describes a glyph.

Public Members

uint32_t bitmap_index

Start index of the bitmap. A font can be max 4 GB.

uint32_t adv_w

Draw the next glyph after this width. 28.4 format (real_value * 16 is stored).

uint16_t box_w

Width of the glyph's bounding box

uint16_t box_h

Height of the glyph's bounding box

int16_t ofs_x

x offset of the bounding box

int16_t ofs_y

y offset of the bounding box. Measured from the top of the line

struct lv_font_fmt_txt_cmap_t
#include <lv_font_fmt_txt.h>

Map codepoints to a glyph_dscs Several formats are supported to optimize memory usage See https://github.com/lvgl/lv_font_conv/blob/master/doc/font_spec.md

Public Members

uint32_t range_start

First Unicode character for this range

uint16_t range_length

Number of Unicode characters related to this range. Last Unicode character = range_start + range_length - 1

uint16_t glyph_id_start

First glyph ID (array index of glyph_dsc) for this range

const uint16_t *unicode_list
const void *glyph_id_ofs_list

if(type == LV_FONT_FMT_TXT_CMAP_FORMAT0_...) it's uint8_t * if(type == LV_FONT_FMT_TXT_CMAP_SPARSE_...) it's uint16_t *

uint16_t list_length

Length of unicode_list and/or glyph_id_ofs_list

lv_font_fmt_txt_cmap_type_t type

Type of this character map

struct lv_font_fmt_txt_kern_pair_t
#include <lv_font_fmt_txt.h>

A simple mapping of kern values from pairs

Public Members

const void *glyph_ids
const int8_t *values
uint32_t pair_cnt
uint32_t glyph_ids_size

0: glyph_ids is stored as uint8_t; 1: as uint16_t

struct lv_font_fmt_txt_kern_classes_t
#include <lv_font_fmt_txt.h>

More complex but more optimal class based kern value storage

Public Members

const int8_t *class_pair_values

left_class_cnt * right_class_cnt value

const uint8_t *left_class_mapping

Map the glyph_ids to classes: index -> glyph_id -> class_id

const uint8_t *right_class_mapping

Map the glyph_ids to classes: index -> glyph_id -> class_id

uint8_t left_class_cnt
uint8_t right_class_cnt
struct lv_font_fmt_txt_dsc_t
#include <lv_font_fmt_txt.h>

Describe store for additional data for fonts

Public Members

const uint8_t *glyph_bitmap

The bitmaps of all glyphs

const lv_font_fmt_txt_glyph_dsc_t *glyph_dsc

Describe the glyphs

const lv_font_fmt_txt_cmap_t *cmaps

Map the glyphs to Unicode characters. Array of lv_font_cmap_fmt_txt_t variables

const void *kern_dsc

Store kerning values. Can be lv_font_fmt_txt_kern_pair_t * orlv_font_kern_classes_fmt_txt_t * depending onkern_classes`

uint16_t kern_scale

Scale kern values in 12.4 format

uint16_t cmap_num

Number of cmap tables

uint16_t bpp

Bit per pixel: 1, 2, 3, 4, 8

uint16_t kern_classes

Type of kern_dsc

uint16_t bitmap_format

storage format of the bitmap from lv_font_fmt_txt_bitmap_format_t