From 39345de1cd649f81b903c9701de5f14dca5e3286 Mon Sep 17 00:00:00 2001 From: Liam <30486941+liamHowatt@users.noreply.github.com> Date: Sat, 3 Aug 2024 02:33:59 -0400 Subject: [PATCH] fix(API): keep font struct lv_font_fmt_txt_kern_pair_t public (#6625) --- src/font/lv_font_fmt_txt.h | 15 +++++++++++++++ src/font/lv_font_fmt_txt_private.h | 15 --------------- src/misc/lv_types.h | 2 -- tests/src/test_cases/test_font_loader.c | 1 - 4 files changed, 15 insertions(+), 18 deletions(-) diff --git a/src/font/lv_font_fmt_txt.h b/src/font/lv_font_fmt_txt.h index 057a05a0e8..8f299010df 100644 --- a/src/font/lv_font_fmt_txt.h +++ b/src/font/lv_font_fmt_txt.h @@ -108,6 +108,21 @@ typedef struct { lv_font_fmt_txt_cmap_type_t type; } lv_font_fmt_txt_cmap_t; +/** A simple mapping of kern values from pairs*/ +typedef struct { + /*To get a kern value of two code points: + 1. Get the `glyph_id_left` and `glyph_id_right` from `lv_font_fmt_txt_cmap_t + 2. for(i = 0; i < pair_cnt * 2; i += 2) + if(glyph_ids[i] == glyph_id_left && + glyph_ids[i+1] == glyph_id_right) + return values[i / 2]; + */ + const void * glyph_ids; + const int8_t * values; + uint32_t pair_cnt : 30; + uint32_t glyph_ids_size : 2; /*0: `glyph_ids` is stored as `uint8_t`; 1: as `uint16_t`*/ +} lv_font_fmt_txt_kern_pair_t; + /** More complex but more optimal class based kern value storage*/ typedef struct { /*To get a kern value of two code points: diff --git a/src/font/lv_font_fmt_txt_private.h b/src/font/lv_font_fmt_txt_private.h index 21d4d94aa8..66df402d6b 100644 --- a/src/font/lv_font_fmt_txt_private.h +++ b/src/font/lv_font_fmt_txt_private.h @@ -24,21 +24,6 @@ extern "C" { * TYPEDEFS **********************/ -/** A simple mapping of kern values from pairs*/ -struct lv_font_fmt_txt_kern_pair_t { - /*To get a kern value of two code points: - 1. Get the `glyph_id_left` and `glyph_id_right` from `lv_font_fmt_txt_cmap_t - 2. for(i = 0; i < pair_cnt * 2; i += 2) - if(glyph_ids[i] == glyph_id_left && - glyph_ids[i+1] == glyph_id_right) - return values[i / 2]; - */ - const void * glyph_ids; - const int8_t * values; - uint32_t pair_cnt : 30; - uint32_t glyph_ids_size : 2; /*0: `glyph_ids` is stored as `uint8_t`; 1: as `uint16_t`*/ -}; - #if LV_USE_FONT_COMPRESSED typedef enum { RLE_STATE_SINGLE = 0, diff --git a/src/misc/lv_types.h b/src/misc/lv_types.h index 891259ec8c..d2e48e6118 100644 --- a/src/misc/lv_types.h +++ b/src/misc/lv_types.h @@ -169,8 +169,6 @@ typedef struct lv_cover_check_info_t lv_cover_check_info_t; typedef struct lv_obj_spec_attr_t lv_obj_spec_attr_t; -typedef struct lv_font_fmt_txt_kern_pair_t lv_font_fmt_txt_kern_pair_t; - typedef struct lv_image_t lv_image_t; typedef struct lv_animimg_t lv_animimg_t; diff --git a/tests/src/test_cases/test_font_loader.c b/tests/src/test_cases/test_font_loader.c index ff639c6a7e..26a4d75241 100644 --- a/tests/src/test_cases/test_font_loader.c +++ b/tests/src/test_cases/test_font_loader.c @@ -9,7 +9,6 @@ #if LV_BUILD_TEST #include "../../lvgl.h" -#include "../../lvgl_private.h" #include "unity/unity.h"