feat(font): make all fonts const

This commit is contained in:
Gabor Kiss-Vamosi
2021-03-08 20:08:51 +01:00
parent cdbbdc36bb
commit 4f70bbf182
30 changed files with 3573 additions and 2937 deletions
+10
View File
@@ -101,3 +101,13 @@ os.system('sed -i \'s|#include "lvgl/lvgl.h"|#include "../../lvgl.h"|\' lv_font_
print("\nGenerating 16 px Hebrew, Persian")
os.system("./built_in_font_gen.py --size 16 -o lv_font_dejavu_16_persian_hebrew.c --bpp 4 --font DejaVuSans.ttf -r 0x20-0x7f,0x5d0-0x5ea,0x600-0x6FF,0xFB50-0xFDFF,0xFE70-0xFEFF")
os.system('sed -i \'s|#include "lvgl/lvgl.h"|#include "../../lvgl.h"|\' lv_font_dejavu_16_persian_hebrew.c')
print("\nGenerating 8 px unscii")
os.system("lv_font_conv --no-compress --no-prefilter --bpp 1 --size 8 --font unscii-8.ttf -r 0x20-0x7F --format lvgl -o lv_font_unscii_8.c --force-fast-kern-format")
os.system('sed -i \'s|#include "lvgl/lvgl.h"|#include "../../lvgl.h"|\' lv_font_unscii_8.c')
print("\nGenerating 16 px unscii")
os.system("lv_font_conv --no-compress --no-prefilter --bpp 1 --size 16 --font unscii-8.ttf -r 0x20-0x7F --format lvgl -o lv_font_unscii_16.c --force-fast-kern-format")
os.system('sed -i \'s|#include "lvgl/lvgl.h"|#include "../../lvgl.h"|\' lv_font_unscii_16.c')
Binary file not shown.
+2 -2
View File
@@ -122,7 +122,7 @@ static inline lv_coord_t lv_font_get_line_height(const lv_font_t * font_p)
* MACROS
**********************/
#define LV_FONT_DECLARE(font_name) extern lv_font_t font_name;
#define LV_FONT_DECLARE(font_name) extern const lv_font_t font_name;
#if LV_FONT_MONTSERRAT_8
LV_FONT_DECLARE(lv_font_montserrat_8)
@@ -137,7 +137,7 @@ LV_FONT_DECLARE(lv_font_montserrat_12)
#endif
#if LV_FONT_MONTSERRAT_14
LV_FONT_DECLARE(const lv_font_montserrat_14)
LV_FONT_DECLARE(lv_font_montserrat_14)
#endif
#if LV_FONT_MONTSERRAT_16
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large Load Diff
+130 -104
View File
@@ -1,13 +1,17 @@
#include "../../lvgl.h"
/*******************************************************************************
* Size: 8 px
* Bpp: 1
* Opts:
* Opts: --no-compress --no-prefilter --bpp 1 --size 8 --font unscii-8.ttf -r 0x20-0x7F --format lvgl -o lv_font_unscii_8.c --force-fast-kern-format
******************************************************************************/
#ifdef LV_LVGL_H_INCLUDE_SIMPLE
#include "lvgl.h"
#else
#include "../../lvgl.h"
#endif
#ifndef LV_FONT_UNSCII_8
#define LV_FONT_UNSCII_8 1
#define LV_FONT_UNSCII_8 1
#endif
#if LV_FONT_UNSCII_8
@@ -17,296 +21,297 @@
*----------------*/
/*Store the image of the glyphs*/
static LV_ATTRIBUTE_LARGE_CONST const uint8_t gylph_bitmap[] = {
/* U+20 " " */
static LV_ATTRIBUTE_LARGE_CONST const uint8_t glyph_bitmap[] = {
/* U+0020 " " */
0x0,
/* U+21 "!" */
/* U+0021 "!" */
0xff, 0xcc,
/* U+22 "\"" */
/* U+0022 "\"" */
0xcf, 0x3c, 0xc0,
/* U+23 "#" */
/* U+0023 "#" */
0x6c, 0xdb, 0xfb, 0x6f, 0xed, 0x9b, 0x0,
/* U+24 "$" */
/* U+0024 "$" */
0x31, 0xfc, 0x1e, 0xf, 0xe3, 0x0,
/* U+25 "%" */
/* U+0025 "%" */
0xc7, 0x98, 0x61, 0x86, 0x78, 0xc0,
/* U+26 "&" */
/* U+0026 "&" */
0x38, 0xd8, 0xe3, 0xbd, 0xd9, 0x9d, 0x80,
/* U+27 "'" */
/* U+0027 "'" */
0x6f, 0x0,
/* U+28 "(" */
/* U+0028 "(" */
0x36, 0xcc, 0xc6, 0x30,
/* U+29 ")" */
/* U+0029 ")" */
0xc6, 0x33, 0x36, 0xc0,
/* U+2A "*" */
/* U+002A "*" */
0x66, 0x3c, 0xff, 0x3c, 0x66,
/* U+2B "+" */
/* U+002B "+" */
0x30, 0xcf, 0xcc, 0x30,
/* U+2C "," */
/* U+002C "," */
0x6f, 0x0,
/* U+2D "-" */
/* U+002D "-" */
0xfc,
/* U+2E "." */
/* U+002E "." */
0xf0,
/* U+2F "/" */
/* U+002F "/" */
0x3, 0x6, 0xc, 0x18, 0x30, 0x60, 0xc0,
/* U+30 "0" */
/* U+0030 "0" */
0x7b, 0x3d, 0xfb, 0xcf, 0x37, 0x80,
/* U+31 "1" */
/* U+0031 "1" */
0x31, 0xc3, 0xc, 0x30, 0xcf, 0xc0,
/* U+32 "2" */
/* U+0032 "2" */
0x7b, 0x31, 0x8c, 0x63, 0xf, 0xc0,
/* U+33 "3" */
/* U+0033 "3" */
0x7b, 0x30, 0xce, 0xf, 0x37, 0x80,
/* U+34 "4" */
/* U+0034 "4" */
0x1c, 0x79, 0xb6, 0x6f, 0xe1, 0x83, 0x0,
/* U+35 "5" */
/* U+0035 "5" */
0xff, 0xf, 0x83, 0xf, 0x37, 0x80,
/* U+36 "6" */
/* U+0036 "6" */
0x39, 0x8c, 0x3e, 0xcf, 0x37, 0x80,
/* U+37 "7" */
/* U+0037 "7" */
0xfc, 0x30, 0xc6, 0x30, 0xc3, 0x0,
/* U+38 "8" */
/* U+0038 "8" */
0x7b, 0x3c, 0xde, 0xcf, 0x37, 0x80,
/* U+39 "9" */
/* U+0039 "9" */
0x7b, 0x3c, 0xdf, 0xc, 0x67, 0x0,
/* U+3A ":" */
/* U+003A ":" */
0xf0, 0xf0,
/* U+3B ";" */
/* U+003B ";" */
0x6c, 0x6, 0xf0,
/* U+3C "<" */
/* U+003C "<" */
0x19, 0x99, 0x86, 0x18, 0x60,
/* U+3D "=" */
/* U+003D "=" */
0xfc, 0xf, 0xc0,
/* U+3E ">" */
/* U+003E ">" */
0xc3, 0xc, 0x33, 0x33, 0x0,
/* U+3F "?" */
/* U+003F "?" */
0x7b, 0x30, 0xc6, 0x30, 0x3, 0x0,
/* U+40 "@" */
/* U+0040 "@" */
0x7d, 0x8f, 0x7e, 0xfd, 0xf8, 0x1f, 0x0,
/* U+41 "A" */
/* U+0041 "A" */
0x31, 0xec, 0xf3, 0xff, 0x3c, 0xc0,
/* U+42 "B" */
/* U+0042 "B" */
0xfb, 0x3c, 0xfe, 0xcf, 0x3f, 0x80,
/* U+43 "C" */
/* U+0043 "C" */
0x7b, 0x3c, 0x30, 0xc3, 0x37, 0x80,
/* U+44 "D" */
/* U+0044 "D" */
0xf3, 0x6c, 0xf3, 0xcf, 0x6f, 0x0,
/* U+45 "E" */
/* U+0045 "E" */
0xff, 0xc, 0x3e, 0xc3, 0xf, 0xc0,
/* U+46 "F" */
/* U+0046 "F" */
0xff, 0xc, 0x3e, 0xc3, 0xc, 0x0,
/* U+47 "G" */
/* U+0047 "G" */
0x7b, 0x3c, 0x37, 0xcf, 0x37, 0xc0,
/* U+48 "H" */
/* U+0048 "H" */
0xcf, 0x3c, 0xff, 0xcf, 0x3c, 0xc0,
/* U+49 "I" */
/* U+0049 "I" */
0xfc, 0xc3, 0xc, 0x30, 0xcf, 0xc0,
/* U+4A "J" */
/* U+004A "J" */
0xc, 0x30, 0xc3, 0xf, 0x37, 0x80,
/* U+4B "K" */
/* U+004B "K" */
0xc7, 0x9b, 0x67, 0x8d, 0x99, 0xb1, 0x80,
/* U+4C "L" */
/* U+004C "L" */
0xc3, 0xc, 0x30, 0xc3, 0xf, 0xc0,
/* U+4D "M" */
/* U+004D "M" */
0xc7, 0xdf, 0xfe, 0xbc, 0x78, 0xf1, 0x80,
/* U+4E "N" */
/* U+004E "N" */
0xc7, 0xcf, 0xde, 0xfc, 0xf8, 0xf1, 0x80,
/* U+4F "O" */
/* U+004F "O" */
0x7b, 0x3c, 0xf3, 0xcf, 0x37, 0x80,
/* U+50 "P" */
/* U+0050 "P" */
0xfb, 0x3c, 0xfe, 0xc3, 0xc, 0x0,
/* U+51 "Q" */
/* U+0051 "Q" */
0x7b, 0x3c, 0xf3, 0xcf, 0x66, 0xc0,
/* U+52 "R" */
/* U+0052 "R" */
0xfb, 0x3c, 0xfe, 0xdb, 0x3c, 0xc0,
/* U+53 "S" */
/* U+0053 "S" */
0x7b, 0x3c, 0x1e, 0xf, 0x37, 0x80,
/* U+54 "T" */
/* U+0054 "T" */
0xfc, 0xc3, 0xc, 0x30, 0xc3, 0x0,
/* U+55 "U" */
/* U+0055 "U" */
0xcf, 0x3c, 0xf3, 0xcf, 0x37, 0x80,
/* U+56 "V" */
/* U+0056 "V" */
0xcf, 0x3c, 0xf3, 0xcd, 0xe3, 0x0,
/* U+57 "W" */
/* U+0057 "W" */
0xc7, 0x8f, 0x1e, 0xbf, 0xfd, 0xf1, 0x80,
/* U+58 "X" */
/* U+0058 "X" */
0xc3, 0x66, 0x3c, 0x18, 0x3c, 0x66, 0xc3,
/* U+59 "Y" */
/* U+0059 "Y" */
0xc3, 0x66, 0x3c, 0x18, 0x18, 0x18, 0x18,
/* U+5A "Z" */
/* U+005A "Z" */
0xfc, 0x31, 0x8c, 0x63, 0xf, 0xc0,
/* U+5B "[" */
/* U+005B "[" */
0xfc, 0xcc, 0xcc, 0xf0,
/* U+5C "\\" */
/* U+005C "\\" */
0xc0, 0x60, 0x30, 0x18, 0xc, 0x6, 0x3,
/* U+5D "]" */
/* U+005D "]" */
0xf3, 0x33, 0x33, 0xf0,
/* U+5E "^" */
/* U+005E "^" */
0x10, 0x71, 0xb6, 0x30,
/* U+5F "_" */
/* U+005F "_" */
0xff,
/* U+60 "`" */
/* U+0060 "`" */
0xc6, 0x30,
/* U+61 "a" */
/* U+0061 "a" */
0x78, 0x37, 0xf3, 0x7c,
/* U+62 "b" */
/* U+0062 "b" */
0xc3, 0xf, 0xb3, 0xcf, 0x3f, 0x80,
/* U+63 "c" */
/* U+0063 "c" */
0x7e, 0x31, 0x87, 0x80,
/* U+64 "d" */
/* U+0064 "d" */
0xc, 0x37, 0xf3, 0xcf, 0x37, 0xc0,
/* U+65 "e" */
/* U+0065 "e" */
0x7b, 0x3f, 0xf0, 0x78,
/* U+66 "f" */
/* U+0066 "f" */
0x3b, 0x3e, 0xc6, 0x31, 0x80,
/* U+67 "g" */
/* U+0067 "g" */
0x7f, 0x3c, 0xdf, 0xf, 0xe0,
/* U+68 "h" */
/* U+0068 "h" */
0xc3, 0xf, 0xb3, 0xcf, 0x3c, 0xc0,
/* U+69 "i" */
/* U+0069 "i" */
0x60, 0x38, 0xc6, 0x31, 0xe0,
/* U+6A "j" */
/* U+006A "j" */
0x18, 0x6, 0x31, 0x8c, 0x7e,
/* U+6B "k" */
/* U+006B "k" */
0xc3, 0xc, 0xf6, 0xf3, 0x6c, 0xc0,
/* U+6C "l" */
/* U+006C "l" */
0xe3, 0x18, 0xc6, 0x31, 0xe0,
/* U+6D "m" */
/* U+006D "m" */
0xcd, 0xff, 0x5e, 0xbc, 0x60,
/* U+6E "n" */
/* U+006E "n" */
0xfb, 0x3c, 0xf3, 0xcc,
/* U+6F "o" */
/* U+006F "o" */
0x7b, 0x3c, 0xf3, 0x78,
/* U+70 "p" */
/* U+0070 "p" */
0xfb, 0x3c, 0xfe, 0xc3, 0x0,
/* U+71 "q" */
/* U+0071 "q" */
0x7f, 0x3c, 0xdf, 0xc, 0x30,
/* U+72 "r" */
/* U+0072 "r" */
0xfb, 0x3c, 0x30, 0xc0,
/* U+73 "s" */
/* U+0073 "s" */
0x7f, 0x7, 0x83, 0xf8,
/* U+74 "t" */
/* U+0074 "t" */
0x61, 0x8f, 0xd8, 0x61, 0x83, 0xc0,
/* U+75 "u" */
/* U+0075 "u" */
0xcf, 0x3c, 0xf3, 0x7c,
/* U+76 "v" */
/* U+0076 "v" */
0xcf, 0x3c, 0xde, 0x30,
/* U+77 "w" */
/* U+0077 "w" */
0xc7, 0x8f, 0x5b, 0xe6, 0xc0,
/* U+78 "x" */
/* U+0078 "x" */
0xc6, 0xd8, 0xe3, 0x6c, 0x60,
/* U+79 "y" */
/* U+0079 "y" */
0xcf, 0x3c, 0xdf, 0xd, 0xe0,
/* U+7A "z" */
/* U+007A "z" */
0xfc, 0x63, 0x18, 0xfc,
/* U+7B "{" */
/* U+007B "{" */
0x1c, 0xc3, 0x38, 0x30, 0xc1, 0xc0,
/* U+7C "|" */
/* U+007C "|" */
0xff, 0xfc,
/* U+7D "}" */
/* U+007D "}" */
0xe0, 0xc3, 0x7, 0x30, 0xce, 0x0,
/* U+7E "~" */
/* U+007E "~" */
0x77, 0xb8,
/* U+7F "" */
/* U+007F "" */
0xc1, 0x42, 0xbd, 0x2c, 0x40, 0x81, 0x0
};
/*---------------------
* GLYPH DESCRIPTION
*--------------------*/
@@ -415,21 +420,31 @@ static const lv_font_fmt_txt_glyph_dsc_t glyph_dsc[] = {
* CHARACTER MAPPING
*--------------------*/
/*Collect the unicode lists and glyph_id offsets*/
static const lv_font_fmt_txt_cmap_t cmaps[] = {
static const lv_font_fmt_txt_cmap_t cmaps[] =
{
{
.range_start = 32, .range_length = 96, .glyph_id_start = 1,
.unicode_list = NULL, .glyph_id_ofs_list = NULL, .list_length = 0, .type = LV_FONT_FMT_TXT_CMAP_FORMAT0_TINY
}
};
/*--------------------
* ALL CUSTOM DATA
*--------------------*/
#if LV_VERSION_CHECK(8, 0, 0)
/*Store all the custom data of the font*/
static lv_font_fmt_txt_glyph_cache_t cache;
static const lv_font_fmt_txt_dsc_t font_dsc = {
#else
static lv_font_fmt_txt_dsc_t font_dsc = {
.glyph_bitmap = gylph_bitmap,
#endif
.glyph_bitmap = glyph_bitmap,
.glyph_dsc = glyph_dsc,
.cmaps = cmaps,
.kern_dsc = NULL,
@@ -437,15 +452,23 @@ static lv_font_fmt_txt_dsc_t font_dsc = {
.cmap_num = 1,
.bpp = 1,
.kern_classes = 0,
.bitmap_format = 0
.bitmap_format = 0,
#if LV_VERSION_CHECK(8, 0, 0)
.cache = &cache
#endif
};
/*-----------------
* PUBLIC FONT
*----------------*/
/*Initialize a public general font descriptor*/
#if LV_VERSION_CHECK(8, 0, 0)
const lv_font_t lv_font_unscii_8 = {
#else
lv_font_t lv_font_unscii_8 = {
#endif
.get_glyph_dsc = lv_font_get_glyph_dsc_fmt_txt, /*Function pointer to get glyph's data*/
.get_glyph_bitmap = lv_font_get_bitmap_fmt_txt, /*Function pointer to get glyph's bitmap*/
.line_height = 9, /*The maximum line height required by the font*/
@@ -460,4 +483,7 @@ lv_font_t lv_font_unscii_8 = {
.dsc = &font_dsc /*The custom font data. Will be accessed by `get_glyph_bitmap/dsc` */
};
#endif /*#if LV_FONT_UNSCII_8*/