lv_font_fmt_txt.h

Typedefs

typedef _lv_font_fmt_txt_cmap_type_t lv_font_fmt_txt_cmap_type_t

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

Functions

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

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

参数:
  • g_dsc -- the glyph descriptor including which font to use etc.

  • letter -- a UNICODE character code

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

返回:

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.

参数:
  • 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

返回:

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 1 MB.

uint32_t adv_w

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

uint8_t box_w

Width of the glyph's bounding box

uint8_t box_h

Height of the glyph's bounding box

int8_t ofs_x

x offset of the bounding box

int8_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
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
const uint8_t *left_class_mapping
const uint8_t *right_class_mapping
uint8_t left_class_cnt
uint8_t right_class_cnt
struct lv_font_fmt_txt_dsc_t

Public Members

const uint8_t *glyph_bitmap
const lv_font_fmt_txt_glyph_dsc_t *glyph_dsc
const lv_font_fmt_txt_cmap_t *cmaps
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
uint16_t cmap_num
uint16_t bpp
uint16_t kern_classes
uint16_t bitmap_format