Compare commits

..

86 Commits

Author SHA1 Message Date
Gabor Kiss-Vamosi
81e5690b2c Release v7.10.0 2021-02-02 15:12:11 +01:00
Gabor Kiss-Vamosi
222afe9e9b Update CHANGELOG.md 2021-02-02 15:00:53 +01:00
embeddedt
b38ceb52eb fix(lv_version) add proper C++ prototype to functions 2021-02-01 08:55:03 -05:00
Xiang Xiao
ced4f2a61f fix(font): load_glyph calculate the wrong size(one byte short) of last glyph (#2042)
* fix(font): load_glyph calculate the wrong size(one byte short) of last glyph

* Print the banner before running the font test
2021-02-01 12:09:16 +01:00
Carlos Diaz
5e8d053adf fix(issue-templates) correct typos in dev-discussion.md (#2047) 2021-01-31 13:11:08 -05:00
embeddedt
9fa5216263 fix(spinbox) cast ext_attr for C++ (#2051) 2021-01-31 12:51:23 -05:00
minyiky
27154b632c feat(spinbox) add get_step function (#2051)
Adds a static inline function to allow access to the step parameter for the spinbox widget
2021-01-31 11:40:57 -05:00
Xiang Xiao
9003f4a9e3 Fix various issues found in font module(2) (#2044)
* fix(font): Remove the unnecessary and duplicated inclusion

and correct some wrong comment too

* fix(font): Handle the out of memory gracefully in decompression case

and remove the check of gdsc since it is impossible to become null

* fix(font): Use the correct type to avoid the cast and shift

* fix(font): Change the bit field width to occupy the whole byte
2021-01-28 09:48:26 +01:00
Xiang Xiao
1e91569763 Fix various issues found in font module (#2040)
* fix(font): Correct _LV_STR_SYMBOL_ generation command

and add _LV_STR_SYMBOL_BULLET to the list

* fix(font): lv_font_load shouldn't call lv_fs_close if lv_fs_open fail

* fix(font): read_bits should return 0 not -1 in error case

to avoid read_bits_signed waste time to extend the sign bit

* fix(font): Correct the return type of read_bits to unsgined int

and extend the sign bit more efficient and correct

* fix(font): Sync LV_FONT_FMT_TXT_CMAP_ value to binary font spec

and then remove the hard code value from source code:
https://github.com/lvgl/lv_font_conv/blame/master/doc/font_spec.md#L96
remove zero fields statement too since font_dsc->cmaps already zero at line 334.

* fix(font): Improve the performance by reading cmap table by once

* fix(font): Improve the loading performance if the header is multipled by 8bits

* fix(font): Read loca table in batch if the size is 32bits

* fix(font): Load the underline related attributes

spec here:
https://github.com/lvgl/lv_font_conv/blame/master/doc/font_spec.md#L55-L56
2021-01-27 11:20:36 +01:00
Gabor Kiss-Vamosi
df3cf24db4 fix(indev): fix implementation of LV_PROTECT_EVENT_TO_DISABLED 2021-01-27 10:37:38 +01:00
Gabor Kiss-Vamosi
b6db434c21 fix(btnmatrix): fix lv_btnmatrix_get_active_btn_text() when used in a group 2021-01-27 10:00:08 +01:00
embeddedt
19f769f1d7 Fix incorrect version for new feature in CHANGELOG 2021-01-26 12:18:33 -05:00
scandermore
dacca6eeb8 feat(indev) allow input events to be passed to disabled objects (#2033) 2021-01-26 12:16:47 -05:00
Linch
eaacde6722 fixs draw pattern stack-use-after-scope error (#2030)
* fixs draw pattern stack-use-after-scope error

* Update CHANGELOG.md
2021-01-20 11:57:33 +01:00
Gabor Kiss-Vamosi
762c0a3274 Update ROADMAP.md 2021-01-20 11:56:54 +01:00
Gabor Kiss-Vamosi
f6fe3dcc8c Update ROADMAP.md 2021-01-19 15:57:27 +01:00
Gabor Kiss-Vamosi
011f105038 Merge branch 'master' of https://github.com/littlevgl/lvgl 2021-01-19 14:54:10 +01:00
Gabor Kiss-Vamosi
aaf4ee95f1 fix(release script) add missed merging of lv_examples to release branch 2021-01-19 14:53:54 +01:00
Gabor Kiss-Vamosi
7740085a08 Merge branch 'master' into dev 2021-01-19 14:36:38 +01:00
Gabor Kiss-Vamosi
b639ddc3bc Update CHANGELOG.md 2021-01-19 14:32:22 +01:00
Gabor Kiss-Vamosi
c03ffd7c3c Update CHANGELOG.md 2021-01-19 14:31:47 +01:00
github-actions[bot]
32b2381168 Merge 60be7c1cee into dev 2021-01-19 09:09:03 +00:00
github-actions[bot]
3dbaa25911 Merge a637f415d7 into dev 2021-01-18 08:14:19 +00:00
github-actions[bot]
680d537607 Merge c9b97feea8 into dev 2021-01-17 14:04:07 +00:00
github-actions[bot]
bb2d633e33 Merge 873551bb5e into dev 2021-01-15 19:31:51 +00:00
github-actions[bot]
31622a811d Merge bc25998c5b into dev 2021-01-12 18:26:55 +00:00
github-actions[bot]
febe314b3b Merge 9ca4ffd64d into dev 2021-01-12 16:02:18 +00:00
github-actions[bot]
8e93df38a1 Merge d6ca15a749 into dev 2021-01-12 15:14:18 +00:00
github-actions[bot]
49124b4ef0 Merge 486053012d into dev 2021-01-12 11:16:38 +00:00
github-actions[bot]
47ad247988 Merge c083d19b52 into dev 2021-01-12 11:07:33 +00:00
github-actions[bot]
f170e1d2ec Merge 138fcfec79 into dev 2021-01-12 11:00:50 +00:00
github-actions[bot]
595bb0b062 Merge c20d5d81f2 into dev 2021-01-11 13:38:56 +00:00
Gabor Kiss-Vamosi
0f0c2790fb merge master 2021-01-11 14:35:26 +01:00
github-actions[bot]
18444e5ce3 Merge 52ba06a228 into dev 2021-01-11 12:11:25 +00:00
github-actions[bot]
6e862b0f83 Merge 923f989b39 into dev 2021-01-11 12:10:32 +00:00
github-actions[bot]
b66600d0c8 Merge a2e9f03eda into dev 2021-01-11 09:26:54 +00:00
github-actions[bot]
57df8f4175 Merge 4cff14f823 into dev 2021-01-11 09:23:20 +00:00
github-actions[bot]
1a04b54f2b Merge 0d52a60200 into dev 2021-01-09 20:25:57 +00:00
github-actions[bot]
6ae11b7a46 Merge c988b68605 into dev 2021-01-09 20:25:39 +00:00
github-actions[bot]
4249b9edc5 Merge 7d3a6c8de4 into dev 2021-01-08 13:36:42 +00:00
github-actions[bot]
2aba361ebd Merge 636ea46a44 into dev 2021-01-08 13:34:17 +00:00
github-actions[bot]
c094773b89 Merge 0e2c83813f into dev 2021-01-08 13:33:31 +00:00
github-actions[bot]
0bd48925dc Merge ccc847e975 into dev 2021-01-08 13:25:21 +00:00
github-actions[bot]
4b14785e40 Merge cabbaf093c into dev 2021-01-08 13:24:51 +00:00
github-actions[bot]
a82e6b89e8 Merge d31304a1cc into dev 2021-01-08 13:23:20 +00:00
github-actions[bot]
955ad6fe96 Merge 6de31e9ffc into dev 2021-01-08 13:11:51 +00:00
github-actions[bot]
295d3b42bd Merge e457c33dc2 into dev 2021-01-08 13:10:41 +00:00
github-actions[bot]
045163cc1d Merge 9bb7ff30ec into dev 2021-01-08 13:09:12 +00:00
github-actions[bot]
b9e415fef0 Merge f0fd2b757f into dev 2021-01-08 11:52:51 +00:00
github-actions[bot]
68def59570 Merge 97f1493202 into dev 2021-01-08 11:52:13 +00:00
github-actions[bot]
c8ca027fc6 Merge 20975a2290 into dev 2021-01-07 13:52:49 +00:00
github-actions[bot]
684442d2f3 Merge 7dc3262855 into dev 2021-01-07 13:51:14 +00:00
github-actions[bot]
6ecf888dbb Merge 0110a1888d into dev 2021-01-07 13:49:43 +00:00
github-actions[bot]
843e5f4236 Merge 74564b7c7e into dev 2021-01-07 12:46:49 +00:00
github-actions[bot]
e12eedc0e3 Merge b391c64434 into dev 2021-01-07 12:33:32 +00:00
Gabor Kiss-Vamosi
a4eab49e94 fix conflicts 2021-01-06 12:09:53 +01:00
Gabor Kiss-Vamosi
ffe9ae5311 Merge branch 'master' into dev 2021-01-05 15:57:36 +01:00
github-actions[bot]
95394e2b2f Merge 8ed224fd63 into dev 2021-01-05 14:52:31 +00:00
github-actions[bot]
e0eb79043f Merge 998ad66c84 into dev 2021-01-05 14:47:37 +00:00
github-actions[bot]
70a9e486c6 Merge 83c55c2a64 into dev 2021-01-04 17:16:10 +00:00
github-actions[bot]
ac910f278a Merge 6ed420e043 into dev 2021-01-04 14:28:13 +00:00
github-actions[bot]
0159438692 Merge de44f74522 into dev 2021-01-04 14:13:13 +00:00
github-actions[bot]
f948f2dcf8 Merge ed5f91ab72 into dev 2021-01-04 13:18:43 +00:00
github-actions[bot]
853dc6bd79 Merge e5f58151ac into dev 2021-01-04 09:48:05 +00:00
github-actions[bot]
7d9f30face Merge 26ab373b43 into dev 2021-01-04 08:55:40 +00:00
github-actions[bot]
ce9ba8220f Merge 3dbee9b584 into dev 2021-01-04 08:46:44 +00:00
github-actions[bot]
dcef7b8b92 Merge 56a48e0173 into dev 2021-01-04 08:43:36 +00:00
github-actions[bot]
d09b52bc61 Merge f0c52b3511 into dev 2020-12-30 16:02:05 +00:00
github-actions[bot]
ab66ee0270 Merge 6dd1884228 into dev 2020-12-30 15:55:09 +00:00
github-actions[bot]
b7a02e130a Merge 20d56ee6e9 into dev 2020-12-27 10:31:32 +00:00
github-actions[bot]
d33d816632 Merge 196bcb9b0e into dev 2020-12-24 16:13:19 +00:00
github-actions[bot]
aca9512213 Merge cee779a56d into dev 2020-12-23 21:00:32 +00:00
Amir Gonnen
f532be9051 lvgl.h: Add lv_version functions (#1973)
These static inline functions return the values of the VERSION macros, making them available for Micropython

See also https://github.com/lvgl/lv_examples/pull/85#issuecomment-749506978
2020-12-23 09:25:06 -05:00
github-actions[bot]
53fd7ec37b Merge 07b6d93de4 into dev 2020-12-22 09:44:57 +00:00
github-actions[bot]
ffdabfd16d Merge 091174069d into dev 2020-12-21 17:55:20 +00:00
github-actions[bot]
6d063ba3aa Merge 43ed3eb1f4 into dev 2020-12-21 15:14:13 +00:00
github-actions[bot]
1661d5ede8 Merge c4d978fa6f into dev 2020-12-20 14:37:02 +00:00
github-actions[bot]
5236ad0f9b Merge 0ca874bc49 into dev 2020-12-20 14:20:22 +00:00
github-actions[bot]
89555372e8 Merge 62d21734d9 into dev 2020-12-20 12:35:15 +00:00
github-actions[bot]
7f15d06a2e Merge cd69be12d1 into dev 2020-12-20 12:33:03 +00:00
github-actions[bot]
5e2dee26cd Merge 1b83855c72 into dev 2020-12-20 12:32:11 +00:00
Ashraf Kamel
2ea03e3745 add arabic keyboard (#1964)
* add arabic keyboard

* add arabic keyboard
2020-12-20 13:25:25 +01:00
github-actions[bot]
5a88573fdb Merge 243145d8c9 into dev 2020-12-20 12:21:41 +00:00
github-actions[bot]
c8ff9f1d5c Merge cb021a425a into dev 2020-12-20 10:00:11 +00:00
github-actions[bot]
cb3ab5daa7 Merge b0fecc6bb2 into dev 2020-12-20 09:57:10 +00:00
Gabor Kiss-Vamosi
67369eed22 Update dev version 2020-12-15 20:13:53 +01:00
23 changed files with 239 additions and 129 deletions

View File

@@ -1,6 +1,6 @@
---
name: Development discussion
about: Discussion strictly related to the develoopment of the LVGL.
about: Discussion strictly related to the development of the LVGL.
title: ''
labels: ''
assignees: ''
@@ -13,7 +13,7 @@ Issues that don't use this template will be ignored and closed.
Normal Feature requests should go to the Forum: https://forum.lvgl.io/c/feature-request/9
-->
### Introcude the problem
### Introduce the problem
<!--
A clear and concise description of the problem.
-->

View File

@@ -1,6 +1,15 @@
# Changelog
## v7.9.1 (Planned at 19.01.2020
## v7.10.0 (Planned for 02.02.2021)
### New features
- feat(indev) allow input events to be passed to disabled objects
- feat(spinbox) add inline get_step function for MicroPython support
### Bugfixes
- fix(btnmatrix) fix lv_btnmatrix_get_active_btn_text() when used in a group
## v7.9.1
### Bugfixes
- fix(cpicker) fix division by zero
@@ -8,9 +17,10 @@
- fix(msgbox) use the animation time provided
- fix(gpu_nxp_pxp) fix incorrect define name
- fix(indev) don't leave edit mode if there is only one object in the group
- fix(draw_rect) fix draw pattern stack-use-after-scope error
## v7.9.0 (Plann1d at 05.01.2020
## v7.9.0
### New features
- feat(chart) add lv_chart_remove_series and lv_chart_hide_series

View File

@@ -35,6 +35,8 @@ Planned to November/December 2020
- Add radio button widget
- Unit testing (gtest?). See [#1658](https://github.com/lvgl/lvgl/issues/1658)
- Benchmarking (gem5?). See [#1660](https://github.com/lvgl/lvgl/issues/1660)
- chart: pre-delete `X` pint after the lastly set
- chart: autoscroll to the right
## v9
- Simplify `group`s. Discussion is [here](https://forum.lvgl.io/t/lv-group-tabindex/2927/3).
@@ -48,6 +50,7 @@ Planned to November/December 2020
- Allow snapshoting object to tranfrom them to images
## Ideas
- Use [generate-changelog](https://github.com/lob/generate-changelog) to automatically generate changelog
- lv_mem_alloc_aligned(size, align)
- Text node. See [#1701](https://github.com/lvgl/lvgl/issues/1701#issuecomment-699479408)
- CPP binding. See [Forum](https://forum.lvgl.io/t/is-it-possible-to-officially-support-optional-cpp-api/2736)

View File

@@ -1,6 +1,6 @@
{
"name": "lvgl",
"version": "7.9.1",
"version": "7.10.0",
"keywords": "graphics, gui, embedded, tft, lvgl",
"description": "Graphics library to create embedded GUI with easy-to-use graphical elements, beautiful visual effects and low memory footprint. It offers anti-aliasing, opacity, and animations using only one frame buffer.",
"repository": {

View File

@@ -1,5 +1,5 @@
name=lvgl
version=7.9.1
version=7.10.0
author=kisvegabor
maintainer=kisvegabor,embeddedt,pete-pjb
sentence=Full-featured Graphics Library for Embedded Systems

View File

@@ -1,6 +1,6 @@
/**
* @file lv_conf.h
* Configuration file for v7.9.1
* Configuration file for v7.10.0
*/
/*

28
lvgl.h
View File

@@ -14,8 +14,8 @@ extern "C" {
* CURRENT VERSION OF LVGL
***************************/
#define LVGL_VERSION_MAJOR 7
#define LVGL_VERSION_MINOR 9
#define LVGL_VERSION_PATCH 1
#define LVGL_VERSION_MINOR 10
#define LVGL_VERSION_PATCH 0
#define LVGL_VERSION_INFO ""
/*********************
@@ -120,6 +120,30 @@ extern "C" {
* */
#define LV_VERSION_CHECK(x,y,z) (x == LVGL_VERSION_MAJOR && (y < LVGL_VERSION_MINOR || (y == LVGL_VERSION_MINOR && z <= LVGL_VERSION_PATCH)))
/**
* Wrapper functions for VERSION macros
*/
static inline int lv_version_major(void)
{
return LVGL_VERSION_MAJOR;
}
static inline int lv_version_minor(void)
{
return LVGL_VERSION_MINOR;
}
static inline int lv_version_patch(void)
{
return LVGL_VERSION_PATCH;
}
static inline const char *lv_version_info(void)
{
return LVGL_VERSION_INFO;
}
#ifdef __cplusplus
}
#endif

View File

@@ -94,6 +94,8 @@ def lv_examples_release(ver):
com.push('origin master')
com.push('origin --tags')
update_release_branch(release_br)
os.chdir("../")
def lv_drivers_release(ver):

View File

@@ -1148,7 +1148,12 @@ lv_obj_t * lv_indev_search_obj(lv_obj_t * obj, lv_point_t * point)
hidden_i = lv_obj_get_parent(hidden_i);
}
/*No parent found with hidden == true*/
if(hidden_i == NULL && (lv_obj_get_state(obj, LV_OBJ_PART_MAIN) & LV_STATE_DISABLED) == false) found_p = obj;
if(lv_obj_is_protected(obj, LV_PROTECT_EVENT_TO_DISABLED) == false) {
if(hidden_i == NULL && (lv_obj_get_state(obj, LV_OBJ_PART_MAIN) & LV_STATE_DISABLED) == false) found_p = obj;
}
else {
if(hidden_i == NULL) found_p = obj;
}
}
}

View File

@@ -177,6 +177,7 @@ enum {
LV_PROTECT_PRESS_LOST = 0x10, /**< If the `indev` was pressing this object but swiped out while
pressing do not search other object.*/
LV_PROTECT_CLICK_FOCUS = 0x20, /**< Prevent focusing the object by clicking on it*/
LV_PROTECT_EVENT_TO_DISABLED = 0x40, /**< Pass events even to disabled objects*/
};
typedef uint8_t lv_protect_t;

View File

@@ -1230,9 +1230,9 @@ static void draw_pattern(const lv_area_t * coords, const lv_area_t * clip, const
if(img_w == 0 || img_h == 0) return;
lv_area_t coords_tmp;
lv_draw_mask_radius_param_t radius_mask_param;
if(dsc->pattern_repeat) {
lv_draw_mask_radius_param_t radius_mask_param;
lv_draw_mask_radius_init(&radius_mask_param, coords, dsc->radius, false);
int16_t radius_mask_id = lv_draw_mask_add(&radius_mask_param, NULL);
@@ -1271,7 +1271,6 @@ static void draw_pattern(const lv_area_t * coords, const lv_area_t * clip, const
int16_t radius_mask_id = LV_MASK_ID_INV;
if(_lv_area_is_in(&coords_tmp, coords, dsc->radius) == false) {
lv_draw_mask_radius_param_t radius_mask_param;
lv_draw_mask_radius_init(&radius_mask_param, coords, dsc->radius, false);
radius_mask_id = lv_draw_mask_add(&radius_mask_param, NULL);
}

View File

@@ -35,7 +35,7 @@ extern "C" {
/** Describes the properties of a glyph. */
typedef struct {
uint16_t adv_w; /**< The glyph needs this space. Draw the next glyph after this width. 8 bit integer, 4 bit fractional */
uint16_t adv_w; /**< The glyph needs this space. Draw the next glyph after this width. */
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*/

View File

@@ -1,5 +1,5 @@
/**
* @file lv_font.c
* @file lv_font_fmt_txt.c
*
*/
@@ -9,7 +9,6 @@
#include "lv_font.h"
#include "lv_font_fmt_txt.h"
#include "../lv_misc/lv_debug.h"
#include "../lv_draw/lv_draw.h"
#include "../lv_misc/lv_types.h"
#include "../lv_misc/lv_gc.h"
#include "../lv_misc/lv_log.h"
@@ -88,7 +87,7 @@ const uint8_t * lv_font_get_bitmap_fmt_txt(const lv_font_t * font, uint32_t unic
const lv_font_fmt_txt_glyph_dsc_t * gdsc = &fdsc->glyph_dsc[gid];
if(fdsc->bitmap_format == LV_FONT_FMT_TXT_PLAIN) {
if(gdsc) return &fdsc->glyph_bitmap[gdsc->bitmap_index];
return &fdsc->glyph_bitmap[gdsc->bitmap_index];
}
/*Handle compressed bitmap*/
else {
@@ -114,15 +113,15 @@ const uint8_t * lv_font_get_bitmap_fmt_txt(const lv_font_t * font, uint32_t unic
}
if(_lv_mem_get_size(LV_GC_ROOT(_lv_font_decompr_buf)) < buf_size) {
LV_GC_ROOT(_lv_font_decompr_buf) = lv_mem_realloc(LV_GC_ROOT(_lv_font_decompr_buf), buf_size);
LV_ASSERT_MEM(LV_GC_ROOT(_lv_font_decompr_buf));
if(LV_GC_ROOT(_lv_font_decompr_buf) == NULL) return NULL;
uint8_t * tmp = lv_mem_realloc(LV_GC_ROOT(_lv_font_decompr_buf), buf_size);
LV_ASSERT_MEM(tmp);
if(tmp == NULL) return NULL;
LV_GC_ROOT(_lv_font_decompr_buf) = tmp;
}
bool prefilter = fdsc->bitmap_format == LV_FONT_FMT_TXT_COMPRESSED ? true : false;
decompress(&fdsc->glyph_bitmap[gdsc->bitmap_index], LV_GC_ROOT(_lv_font_decompr_buf), gdsc->box_w, gdsc->box_h,
(uint8_t)fdsc->bpp,
prefilter);
(uint8_t)fdsc->bpp, prefilter);
return LV_GC_ROOT(_lv_font_decompr_buf);
#else /* !LV_USE_FONT_COMPRESSED */
return NULL;
@@ -224,24 +223,22 @@ static uint32_t get_glyph_dsc_id(const lv_font_t * font, uint32_t letter)
}
else if(fdsc->cmaps[i].type == LV_FONT_FMT_TXT_CMAP_SPARSE_TINY) {
uint16_t key = rcp;
uint8_t * p = _lv_utils_bsearch(&key, fdsc->cmaps[i].unicode_list, fdsc->cmaps[i].list_length,
sizeof(fdsc->cmaps[i].unicode_list[0]), unicode_list_compare);
uint16_t * p = _lv_utils_bsearch(&key, fdsc->cmaps[i].unicode_list, fdsc->cmaps[i].list_length,
sizeof(fdsc->cmaps[i].unicode_list[0]), unicode_list_compare);
if(p) {
lv_uintptr_t ofs = (lv_uintptr_t)(p - (uint8_t *) fdsc->cmaps[i].unicode_list);
ofs = ofs >> 1; /*The list stores `uint16_t` so the get the index divide by 2*/
lv_uintptr_t ofs = p - fdsc->cmaps[i].unicode_list;
glyph_id = fdsc->cmaps[i].glyph_id_start + ofs;
}
}
else if(fdsc->cmaps[i].type == LV_FONT_FMT_TXT_CMAP_SPARSE_FULL) {
uint16_t key = rcp;
uint8_t * p = _lv_utils_bsearch(&key, fdsc->cmaps[i].unicode_list, fdsc->cmaps[i].list_length,
sizeof(fdsc->cmaps[i].unicode_list[0]), unicode_list_compare);
uint16_t * p = _lv_utils_bsearch(&key, fdsc->cmaps[i].unicode_list, fdsc->cmaps[i].list_length,
sizeof(fdsc->cmaps[i].unicode_list[0]), unicode_list_compare);
if(p) {
lv_uintptr_t ofs = (lv_uintptr_t)(p - (uint8_t *) fdsc->cmaps[i].unicode_list);
ofs = ofs >> 1; /*The list stores `uint16_t` so the get the index divide by 2*/
const uint8_t * gid_ofs_16 = fdsc->cmaps[i].glyph_id_ofs_list;
lv_uintptr_t ofs = p - fdsc->cmaps[i].unicode_list;
const uint16_t * gid_ofs_16 = fdsc->cmaps[i].glyph_id_ofs_list;
glyph_id = fdsc->cmaps[i].glyph_id_start + gid_ofs_16[ofs];
}
}
@@ -270,28 +267,26 @@ static int8_t get_kern_value(const lv_font_t * font, uint32_t gid_left, uint32_t
if(kdsc->glyph_ids_size == 0) {
/* Use binary search to find the kern value.
* The pairs are ordered left_id first, then right_id secondly. */
const uint8_t * g_ids = kdsc->glyph_ids;
const uint16_t * g_ids = kdsc->glyph_ids;
uint16_t g_id_both = (gid_right << 8) + gid_left; /*Create one number from the ids*/
uint8_t * kid_p = _lv_utils_bsearch(&g_id_both, g_ids, kdsc->pair_cnt, 2, kern_pair_8_compare);
uint16_t * kid_p = _lv_utils_bsearch(&g_id_both, g_ids, kdsc->pair_cnt, 2, kern_pair_8_compare);
/*If the `g_id_both` were found get its index from the pointer*/
if(kid_p) {
lv_uintptr_t ofs = (lv_uintptr_t)(kid_p - g_ids);
ofs = ofs >> 1; /*ofs is for pair, divide by 2 to refer as a single value*/
lv_uintptr_t ofs = kid_p - g_ids;
value = kdsc->values[ofs];
}
}
else if(kdsc->glyph_ids_size == 1) {
/* Use binary search to find the kern value.
* The pairs are ordered left_id first, then right_id secondly. */
const uint16_t * g_ids = kdsc->glyph_ids;
lv_uintptr_t g_id_both = (uint32_t)((uint32_t)gid_right << 8) + gid_left; /*Create one number from the ids*/
uint8_t * kid_p = _lv_utils_bsearch(&g_id_both, g_ids, kdsc->pair_cnt, 4, kern_pair_16_compare);
const uint32_t * g_ids = kdsc->glyph_ids;
uint32_t g_id_both = (gid_right << 16) + gid_left; /*Create one number from the ids*/
uint32_t * kid_p = _lv_utils_bsearch(&g_id_both, g_ids, kdsc->pair_cnt, 4, kern_pair_16_compare);
/*If the `g_id_both` were found get its index from the pointer*/
if(kid_p) {
lv_uintptr_t ofs = (lv_uintptr_t)(kid_p - (const uint8_t *)g_ids);
ofs = ofs >> 4; /*ofs is 4 byte pairs, divide by 4 to refer as a single value*/
lv_uintptr_t ofs = kid_p - g_ids;
value = kdsc->values[ofs];
}
@@ -576,9 +571,9 @@ static inline uint8_t rle_next(void)
* @param[in] pElement Pointer to the element to compare.
*
* @return Result of comparison.
* @retval < 0 Reference is greater than element.
* @retval < 0 Reference is less than element.
* @retval = 0 Reference is equal to element.
* @retval > 0 Reference is less than element.
* @retval > 0 Reference is greater than element.
*
*/
static int32_t unicode_list_compare(const void * ref, const void * element)

View File

@@ -1,5 +1,5 @@
/**
* @file lv_font.h
* @file lv_font_fmt_txt.h
*
*/
@@ -34,23 +34,23 @@ typedef struct {
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*/
int8_t ofs_y; /**< y offset of the bounding box. Measured from the top of the line*/
#else
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*/
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*/
#endif
} lv_font_fmt_txt_glyph_dsc_t;
/** Format of font character map. */
enum {
LV_FONT_FMT_TXT_CMAP_FORMAT0_TINY,
LV_FONT_FMT_TXT_CMAP_FORMAT0_FULL,
LV_FONT_FMT_TXT_CMAP_SPARSE_TINY,
LV_FONT_FMT_TXT_CMAP_SPARSE_FULL,
LV_FONT_FMT_TXT_CMAP_FORMAT0_TINY,
LV_FONT_FMT_TXT_CMAP_SPARSE_TINY,
};
typedef uint8_t lv_font_fmt_txt_cmap_type_t;
@@ -115,14 +115,14 @@ typedef struct {
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)
2. for(i = 0; i < pair_cnt * 2; i += 2)
if(gylph_ids[i] == glyph_id_left &&
gylph_ids[i+1] == glyph_id_right)
return values[i / 2];
*/
const void * glyph_ids;
const int8_t * values;
uint32_t pair_cnt : 24;
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;
@@ -136,7 +136,7 @@ typedef struct {
3. value = class_pair_values[(left_class-1)*right_class_cnt + (right_class-1)]
*/
const int8_t * class_pair_values; /*left_class_num * right_class_num value*/
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;
@@ -172,7 +172,7 @@ typedef struct {
uint16_t kern_scale;
/*Number of cmap tables*/
uint16_t cmap_num : 10;
uint16_t cmap_num : 9;
/*Bit per pixel: 1, 2, 3, 4, 8*/
uint16_t bpp : 4;

View File

@@ -48,6 +48,8 @@ typedef struct font_header_bin {
uint8_t compression_id;
uint8_t subpixels_mode;
uint8_t padding;
int16_t underline_position;
uint16_t underline_thickness;
} font_header_bin_t;
typedef struct cmap_table_bin {
@@ -68,7 +70,7 @@ static bool lvgl_load_font(lv_fs_file_t * fp, lv_font_t * font);
int32_t load_kern(lv_fs_file_t * fp, lv_font_fmt_txt_dsc_t * font_dsc, uint8_t format, uint32_t start);
static int read_bits_signed(bit_iterator_t * it, int n_bits, lv_fs_res_t * res);
static int read_bits(bit_iterator_t * it, int n_bits, lv_fs_res_t * res);
static unsigned int read_bits(bit_iterator_t * it, int n_bits, lv_fs_res_t * res);
/**********************
* MACROS
@@ -95,20 +97,20 @@ lv_font_t * lv_font_load(const char * font_name)
if(res == LV_FS_RES_OK) {
success = lvgl_load_font(&file, font);
}
if(!success) {
LV_LOG_WARN("Error loading font file: %s\n", font_name);
/*
* When `lvgl_load_font` fails it can leak some pointers.
* All non-null pointers can be assumed as allocated and
* `lv_font_free` should free them correctly.
*/
lv_font_free(font);
font = NULL;
}
if(!success) {
LV_LOG_WARN("Error loading font file: %s\n", font_name);
/*
* When `lvgl_load_font` fails it can leak some pointers.
* All non-null pointers can be assumed as allocated and
* `lv_font_free` should free them correctly.
*/
lv_font_free(font);
font = NULL;
}
lv_fs_close(&file);
lv_fs_close(&file);
}
return font;
}
@@ -194,9 +196,9 @@ static bit_iterator_t init_bit_iterator(lv_fs_file_t * fp)
return it;
}
static int read_bits(bit_iterator_t * it, int n_bits, lv_fs_res_t * res)
static unsigned int read_bits(bit_iterator_t * it, int n_bits, lv_fs_res_t * res)
{
int value = 0;
unsigned int value = 0;
while(n_bits--) {
it->byte_value = it->byte_value << 1;
it->bit_pos--;
@@ -205,7 +207,7 @@ static int read_bits(bit_iterator_t * it, int n_bits, lv_fs_res_t * res)
it->bit_pos = 7;
*res = lv_fs_read(it->fp, &(it->byte_value), 1, NULL);
if(*res != LV_FS_RES_OK) {
return -1;
return 0;
}
}
int8_t bit = (it->byte_value & 0x80) ? 1 : 0;
@@ -218,11 +220,9 @@ static int read_bits(bit_iterator_t * it, int n_bits, lv_fs_res_t * res)
static int read_bits_signed(bit_iterator_t * it, int n_bits, lv_fs_res_t * res)
{
int value = read_bits(it, n_bits, res);
unsigned int value = read_bits(it, n_bits, res);
if(value & (1 << (n_bits - 1))) {
for(int bit = n_bits; bit < 16; ++bit) {
value |= (1 << bit);
}
value |= ~0u << n_bits;
}
return value;
}
@@ -247,16 +247,8 @@ static int read_label(lv_fs_file_t * fp, int start, const char * label)
static bool load_cmaps_tables(lv_fs_file_t * fp, lv_font_fmt_txt_dsc_t * font_dsc,
uint32_t cmaps_start, cmap_table_bin_t * cmap_table)
{
for(unsigned int i = 0; i < font_dsc->cmap_num; ++i) {
if(lv_fs_read(fp, &cmap_table[i], sizeof(cmap_table_bin_t), NULL) != LV_FS_RES_OK) {
return false;
}
lv_font_fmt_txt_cmap_t * cmap = (lv_font_fmt_txt_cmap_t *) & (font_dsc->cmaps[i]);
cmap->range_start = cmap_table[i].range_start;
cmap->range_length = cmap_table[i].range_length;
cmap->glyph_id_start = cmap_table[i].glyph_id_start;
if(lv_fs_read(fp, cmap_table, font_dsc->cmap_num * sizeof(cmap_table_bin_t), NULL) != LV_FS_RES_OK) {
return false;
}
for(unsigned int i = 0; i < font_dsc->cmap_num; ++i) {
@@ -267,8 +259,13 @@ static bool load_cmaps_tables(lv_fs_file_t * fp, lv_font_fmt_txt_dsc_t * font_ds
lv_font_fmt_txt_cmap_t * cmap = (lv_font_fmt_txt_cmap_t *) & (font_dsc->cmaps[i]);
cmap->range_start = cmap_table[i].range_start;
cmap->range_length = cmap_table[i].range_length;
cmap->glyph_id_start = cmap_table[i].glyph_id_start;
cmap->type = cmap_table[i].format_type;
switch(cmap_table[i].format_type) {
case 0: {
case LV_FONT_FMT_TXT_CMAP_FORMAT0_FULL: {
uint8_t ids_size = sizeof(uint8_t) * cmap_table[i].data_entries_count;
uint8_t * glyph_id_ofs_list = lv_mem_alloc(ids_size);
@@ -278,19 +275,13 @@ static bool load_cmaps_tables(lv_fs_file_t * fp, lv_font_fmt_txt_dsc_t * font_ds
return false;
}
cmap->type = LV_FONT_FMT_TXT_CMAP_FORMAT0_FULL;
cmap->list_length = cmap->range_length;
cmap->unicode_list = NULL;
break;
}
case 2:
cmap->type = LV_FONT_FMT_TXT_CMAP_FORMAT0_TINY;
cmap->list_length = 0;
cmap->unicode_list = NULL;
cmap->glyph_id_ofs_list = NULL;
case LV_FONT_FMT_TXT_CMAP_FORMAT0_TINY:
break;
case 1:
case 3: {
case LV_FONT_FMT_TXT_CMAP_SPARSE_FULL:
case LV_FONT_FMT_TXT_CMAP_SPARSE_TINY: {
uint32_t list_size = sizeof(uint16_t) * cmap_table[i].data_entries_count;
uint16_t * unicode_list = (uint16_t *) lv_mem_alloc(list_size);
@@ -301,20 +292,15 @@ static bool load_cmaps_tables(lv_fs_file_t * fp, lv_font_fmt_txt_dsc_t * font_ds
return false;
}
if(cmap_table[i].format_type == 1) {
if(cmap_table[i].format_type == LV_FONT_FMT_TXT_CMAP_SPARSE_FULL) {
uint16_t * buf = lv_mem_alloc(sizeof(uint16_t) * cmap->list_length);
cmap->type = LV_FONT_FMT_TXT_CMAP_SPARSE_FULL;
cmap->glyph_id_ofs_list = buf;
if(lv_fs_read(fp, buf, sizeof(uint16_t) * cmap->list_length, NULL) != LV_FS_RES_OK) {
return false;
}
}
else {
cmap->type = LV_FONT_FMT_TXT_CMAP_SPARSE_TINY;
cmap->glyph_id_ofs_list = NULL;
}
break;
}
default:
@@ -416,7 +402,7 @@ static int32_t load_glyph(lv_fs_file_t * fp, lv_font_fmt_txt_dsc_t * font_dsc,
}
int nbits = header->advance_width_bits + 2 * header->xy_bits + 2 * header->wh_bits;
int next_offset = (i < loca_count - 1) ? glyph_offset[i + 1] : (uint32_t)(glyph_length - 1);
int next_offset = (i < loca_count - 1) ? glyph_offset[i + 1] : (uint32_t)glyph_length;
int bmp_size = next_offset - glyph_offset[i] - nbits / 8;
if(i == 0) {
@@ -457,15 +443,27 @@ static int32_t load_glyph(lv_fs_file_t * fp, lv_font_fmt_txt_dsc_t * font_dsc,
continue;
}
int next_offset = (i < loca_count - 1) ? glyph_offset[i + 1] : (uint32_t)(glyph_length - 1);
int next_offset = (i < loca_count - 1) ? glyph_offset[i + 1] : (uint32_t)glyph_length;
int bmp_size = next_offset - glyph_offset[i] - nbits / 8;
for(int k = 0; k < bmp_size; ++k) {
glyph_bmp[cur_bmp_size + k] = read_bits(&bit_it, 8, &res);
if(nbits % 8 == 0) { /* Fast path */
if(lv_fs_read(fp, &glyph_bmp[cur_bmp_size], bmp_size, NULL) != LV_FS_RES_OK) {
return -1;
}
}
else {
for(int k = 0; k < bmp_size - 1; ++k) {
glyph_bmp[cur_bmp_size + k] = read_bits(&bit_it, 8, &res);
if(res != LV_FS_RES_OK) {
return -1;
}
}
glyph_bmp[cur_bmp_size + bmp_size - 1] = read_bits(&bit_it, 8 - nbits % 8, &res);
if(res != LV_FS_RES_OK) {
return -1;
}
}
cur_bmp_size += bmp_size;
}
return glyph_length;
@@ -508,6 +506,8 @@ static bool lvgl_load_font(lv_fs_file_t * fp, lv_font_t * font)
font->get_glyph_dsc = lv_font_get_glyph_dsc_fmt_txt;
font->get_glyph_bitmap = lv_font_get_bitmap_fmt_txt;
font->subpx = font_header.subpixels_mode;
font->underline_position = font_header.underline_position;
font->underline_thickness = font_header.underline_thickness;
font_dsc->bpp = font_header.bits_per_pixel;
font_dsc->kern_scale = font_header.kerning_scale;
@@ -535,8 +535,8 @@ static bool lvgl_load_font(lv_fs_file_t * fp, lv_font_t * font)
bool failed = false;
uint32_t * glyph_offset = lv_mem_alloc(sizeof(uint32_t) * (loca_count + 1));
for(unsigned int i = 0; i < loca_count; ++i) {
if(font_header.index_to_loc_format == 0) {
if(font_header.index_to_loc_format == 0) {
for(unsigned int i = 0; i < loca_count; ++i) {
uint16_t offset;
if(lv_fs_read(fp, &offset, sizeof(uint16_t), NULL) != LV_FS_RES_OK) {
failed = true;
@@ -544,20 +544,16 @@ static bool lvgl_load_font(lv_fs_file_t * fp, lv_font_t * font)
}
glyph_offset[i] = offset;
}
else if(font_header.index_to_loc_format == 1) {
uint32_t offset;
if(lv_fs_read(fp, &offset, sizeof(uint32_t), NULL) != LV_FS_RES_OK) {
failed = true;
break;
}
glyph_offset[i] = offset;
}
else {
LV_LOG_WARN("Unknown index_to_loc_format: %d.", font_header.index_to_loc_format);
}
else if(font_header.index_to_loc_format == 1) {
if(lv_fs_read(fp, glyph_offset, loca_count * sizeof(uint32_t), NULL) != LV_FS_RES_OK) {
failed = true;
break;
}
}
else {
LV_LOG_WARN("Unknown index_to_loc_format: %d.", font_header.index_to_loc_format);
failed = true;
}
if(failed) {
lv_mem_free(glyph_offset);

View File

@@ -85,11 +85,11 @@ extern "C" {
/*-------------------------------
* Symbols from "normal" font
*-----------------------------*/
#define LV_SYMBOL_BULLET "\xE2\x80\xA2" /*20042, 0x2022*/
#define LV_SYMBOL_BULLET "\xE2\x80\xA2" /*20042, 0x2022*/
/*
* The following list is generated using
* cat src/lv_misc/lv_symbol_def.h | sed -E -n 's/^#define\s+(LV_SYMBOL_\w+).*"$/ _LV_STR_\1,/p'
* cat src/lv_font/lv_symbol_def.h | sed -E -n 's/^#define\s+LV_(SYMBOL_\w+).*".*$/ _LV_STR_\1,/p'
*/
enum {
_LV_STR_SYMBOL_AUDIO,
@@ -150,6 +150,7 @@ enum {
_LV_STR_SYMBOL_SD_CARD,
_LV_STR_SYMBOL_NEW_LINE,
_LV_STR_SYMBOL_DUMMY,
_LV_STR_SYMBOL_BULLET,
};
#ifdef __cplusplus

View File

@@ -18,7 +18,6 @@ extern "C" {
#include <stdbool.h>
#include <stdarg.h>
#include "lv_area.h"
#include "lv_area.h"
#include "../lv_font/lv_font.h"
#include "lv_printf.h"

View File

@@ -293,9 +293,11 @@ void lv_btnmatrix_set_focused_btn(lv_obj_t * btnm, uint16_t id)
if(id >= ext->btn_cnt && id != LV_BTNMATRIX_BTN_NONE) return;
if(id == ext->btn_id_focused) return;
if(ext->btn_id_act == LV_BTNMATRIX_BTN_NONE) ext->btn_id_act = id;
if(id == ext->btn_id_focused) return;
ext->btn_id_focused = id;
lv_obj_invalidate(btnm);
}

View File

@@ -37,40 +37,79 @@ static lv_signal_cb_t ancestor_signal;
static const char * const default_kb_map_lc[] = {"1#", "q", "w", "e", "r", "t", "y", "u", "i", "o", "p", LV_SYMBOL_BACKSPACE, "\n",
"ABC", "a", "s", "d", "f", "g", "h", "j", "k", "l", LV_SYMBOL_NEW_LINE, "\n",
"_", "-", "z", "x", "c", "v", "b", "n", "m", ".", ",", ":", "\n",
LV_SYMBOL_CLOSE, LV_SYMBOL_LEFT, " ", LV_SYMBOL_RIGHT, LV_SYMBOL_OK, ""
LV_SYMBOL_CLOSE,
#if LV_USE_ARABIC_PERSIAN_CHARS == 1
"أب",
#endif
LV_SYMBOL_LEFT, " ", LV_SYMBOL_RIGHT, LV_SYMBOL_OK, ""
};
static const lv_btnmatrix_ctrl_t default_kb_ctrl_lc_map[] = {
LV_KEYBOARD_CTRL_BTN_FLAGS | 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 7,
LV_KEYBOARD_CTRL_BTN_FLAGS | 6, 3, 3, 3, 3, 3, 3, 3, 3, 3, 7,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
LV_KEYBOARD_CTRL_BTN_FLAGS | 2, 2, 6, 2, LV_KEYBOARD_CTRL_BTN_FLAGS | 2
LV_KEYBOARD_CTRL_BTN_FLAGS | 2,
#if LV_USE_ARABIC_PERSIAN_CHARS == 1
LV_KEYBOARD_CTRL_BTN_FLAGS | 2,
#endif
2, 6, 2, LV_KEYBOARD_CTRL_BTN_FLAGS | 2
};
static const char * const default_kb_map_uc[] = {"1#", "Q", "W", "E", "R", "T", "Y", "U", "I", "O", "P", LV_SYMBOL_BACKSPACE, "\n",
"abc", "A", "S", "D", "F", "G", "H", "J", "K", "L", LV_SYMBOL_NEW_LINE, "\n",
"_", "-", "Z", "X", "C", "V", "B", "N", "M", ".", ",", ":", "\n",
LV_SYMBOL_CLOSE, LV_SYMBOL_LEFT, " ", LV_SYMBOL_RIGHT, LV_SYMBOL_OK, ""
LV_SYMBOL_CLOSE,
#if LV_USE_ARABIC_PERSIAN_CHARS == 1
"أب",
#endif
LV_SYMBOL_LEFT, " ", LV_SYMBOL_RIGHT, LV_SYMBOL_OK, ""
};
static const lv_btnmatrix_ctrl_t default_kb_ctrl_uc_map[] = {
LV_KEYBOARD_CTRL_BTN_FLAGS | 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 7,
LV_KEYBOARD_CTRL_BTN_FLAGS | 6, 3, 3, 3, 3, 3, 3, 3, 3, 3, 7,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
LV_KEYBOARD_CTRL_BTN_FLAGS | 2, 2, 6, 2, LV_KEYBOARD_CTRL_BTN_FLAGS | 2
LV_KEYBOARD_CTRL_BTN_FLAGS | 2,
#if LV_USE_ARABIC_PERSIAN_CHARS == 1
LV_KEYBOARD_CTRL_BTN_FLAGS | 2,
#endif
2, 6, 2, LV_KEYBOARD_CTRL_BTN_FLAGS | 2
};
#if LV_USE_ARABIC_PERSIAN_CHARS == 1
static const char * const default_kb_map_ar[] = {
"1#", "ض", "ص", "ث", "ق", "ف", "غ", "ع", "ه", "خ", "ح", "ج", "\n",
"ش", "س", "ي", "ب", "ل", "ا", "ت", "ن", "م", "ك", "ط", LV_SYMBOL_BACKSPACE, "\n",
"ذ", "ء", "ؤ", "ر", "ى", "ة", "و", "ز", "ظ", "د", "ز", "ظ", "د", "\n",
LV_SYMBOL_CLOSE, "abc", LV_SYMBOL_LEFT, " ", LV_SYMBOL_RIGHT, LV_SYMBOL_NEW_LINE, LV_SYMBOL_OK, ""
};
static const lv_btnmatrix_ctrl_t default_kb_ctrl_ar_map[] = {
LV_KEYBOARD_CTRL_BTN_FLAGS | 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 7,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
LV_KEYBOARD_CTRL_BTN_FLAGS | 2, LV_KEYBOARD_CTRL_BTN_FLAGS | 2, 2, 6, 2, 3, LV_KEYBOARD_CTRL_BTN_FLAGS | 2
};
#endif
static const char * const default_kb_map_spec[] = {"1", "2", "3", "4", "5", "6", "7", "8", "9", "0", LV_SYMBOL_BACKSPACE, "\n",
"abc", "+", "-", "/", "*", "=", "%", "!", "?", "#", "<", ">", "\n",
"\\", "@", "$", "(", ")", "{", "}", "[", "]", ";", "\"", "'", "\n",
LV_SYMBOL_CLOSE, LV_SYMBOL_LEFT, " ", LV_SYMBOL_RIGHT, LV_SYMBOL_OK, ""
LV_SYMBOL_CLOSE,
#if LV_USE_ARABIC_PERSIAN_CHARS == 1
"أب",
#endif
LV_SYMBOL_LEFT, " ", LV_SYMBOL_RIGHT, LV_SYMBOL_OK, ""
};
static const lv_btnmatrix_ctrl_t default_kb_ctrl_spec_map[] = {
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2,
LV_KEYBOARD_CTRL_BTN_FLAGS | 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
LV_KEYBOARD_CTRL_BTN_FLAGS | 2, 2, 6, 2, LV_KEYBOARD_CTRL_BTN_FLAGS | 2
LV_KEYBOARD_CTRL_BTN_FLAGS | 2,
#if LV_USE_ARABIC_PERSIAN_CHARS == 1
LV_KEYBOARD_CTRL_BTN_FLAGS | 2,
#endif
2, 6, 2, LV_KEYBOARD_CTRL_BTN_FLAGS | 2
};
static const char * const default_kb_map_num[] = {"1", "2", "3", LV_SYMBOL_CLOSE, "\n",
@@ -87,17 +126,23 @@ static const lv_btnmatrix_ctrl_t default_kb_ctrl_num_map[] = {
};
/* clang-format on */
static const char * * kb_map[4] = {
static const char * * kb_map[] = {
(const char * *)default_kb_map_lc,
(const char * *)default_kb_map_uc,
(const char * *)default_kb_map_spec,
(const char * *)default_kb_map_num
#if LV_USE_ARABIC_PERSIAN_CHARS == 1
, (const char * *)default_kb_map_ar
#endif
};
static const lv_btnmatrix_ctrl_t * kb_ctrl[4] = {
static const lv_btnmatrix_ctrl_t * kb_ctrl[] = {
default_kb_ctrl_lc_map,
default_kb_ctrl_uc_map,
default_kb_ctrl_spec_map,
default_kb_ctrl_num_map
#if LV_USE_ARABIC_PERSIAN_CHARS == 1
, default_kb_ctrl_ar_map
#endif
};
/**********************
@@ -354,6 +399,14 @@ void lv_keyboard_def_event_cb(lv_obj_t * kb, lv_event_t event)
lv_btnmatrix_set_ctrl_map(kb, kb_ctrl[LV_KEYBOARD_MODE_TEXT_LOWER]);
return;
}
#if LV_USE_ARABIC_PERSIAN_CHARS == 1
else if(strcmp(txt, "أب") == 0) {
ext->mode = LV_KEYBOARD_MODE_TEXT_ARABIC;
lv_btnmatrix_set_map(kb, kb_map[LV_KEYBOARD_MODE_TEXT_ARABIC]);
lv_btnmatrix_set_ctrl_map(kb, kb_ctrl[LV_KEYBOARD_MODE_TEXT_ARABIC]);
return;
}
#endif
else if(strcmp(txt, "ABC") == 0) {
ext->mode = LV_KEYBOARD_MODE_TEXT_UPPER;
lv_btnmatrix_set_map(kb, kb_map[LV_KEYBOARD_MODE_TEXT_UPPER]);

View File

@@ -43,7 +43,10 @@ enum {
LV_KEYBOARD_MODE_TEXT_LOWER,
LV_KEYBOARD_MODE_TEXT_UPPER,
LV_KEYBOARD_MODE_SPECIAL,
LV_KEYBOARD_MODE_NUM,
LV_KEYBOARD_MODE_NUM
#if LV_USE_ARABIC_PERSIAN_CHARS == 1
, LV_KEYBOARD_MODE_TEXT_ARABIC
#endif
};
typedef uint8_t lv_keyboard_mode_t;

View File

@@ -135,6 +135,18 @@ bool lv_spinbox_get_rollover(lv_obj_t * spinbox);
*/
int32_t lv_spinbox_get_value(lv_obj_t * spinbox);
/**
* Get the spinbox step value (user has to convert to float according to its digit format)
* @param spinbox pointer to spinbox
* @return value integer step value of the spinbox
*/
static inline int32_t lv_spinbox_get_step(lv_obj_t * spinbox)
{
lv_spinbox_ext_t * ext = (lv_spinbox_ext_t *)lv_obj_get_ext_attr(spinbox);
return ext->step;
}
/*=====================
* Other functions
*====================*/

View File

@@ -51,6 +51,11 @@ extern lv_font_t font_3;
void lv_test_font_loader(void)
{
#if LV_USE_FILESYSTEM
lv_test_print("");
lv_test_print("===================");
lv_test_print("Start lv_font tests");
lv_test_print("===================");
lv_font_t * font_1_bin = lv_font_load("f:font_1.fnt");
lv_font_t * font_2_bin = lv_font_load("f:font_2.fnt");
lv_font_t * font_3_bin = lv_font_load("f:font_3.fnt");

View File

@@ -1,5 +1,5 @@
/**
* @file lv_font_loader.h
* @file lv_test_font_loader.h
*
*/