add 'generate_all.py' script to generate all fonts at once

This commit is contained in:
Gabor Kiss-Vamosi
2020-03-23 12:32:23 +01:00
parent 0d303e16e6
commit 3249700ec5
2 changed files with 30 additions and 2 deletions

View File

@@ -18,7 +18,7 @@ parser.add_argument('--bpp',
parser.add_argument('-r', '--range',
nargs='+',
metavar = 'start-end',
default='0x20-0x7F',
default=['0x20-0x7F,0xB0,0x2022'],
help='Ranges and/or characters to include. Default is 0x20-7F (ASCII). E.g. -r 0x20-0x7F, 0x200, 324')
parser.add_argument('--font',
metavar = 'file',
@@ -31,6 +31,8 @@ parser.add_argument('-o', '--output',
help='Output file name. E.g. my_font_20.c')
parser.add_argument('--compressed', action='store_true',
help='Compress the bitmaps')
parser.add_argument('--subpx', action='store_true',
help='3 times wider letters for sub pixel rendering')
args = parser.parse_args()
@@ -42,6 +44,6 @@ else:
#Built in symbols
syms = "61441,61448,61451,61452,61452,61453,61457,61459,61461,61465,61468,61473,61478,61479,61480,61502,61512,61515,61516,61517,61521,61522,61523,61524,61543,61544,61550,61552,61553,61556,61559,61560,61561,61563,61587,61589,61636,61637,61639,61671,61674,61683,61724,61732,61787,61931,62016,62017,62018,62019,62020,62087,62099,62212,62189,62810,63426,63650"
#Run the command
#Run the command (Add degree and bbullet symbol)
cmd = "lv_font_conv {} --bpp {} --size {} --font Roboto-Regular.woff -r {} --font FontAwesome5-Solid+Brands+Regular.woff -r {} --format lvgl -o {} --force-fast-kern-format".format(compr, args.bpp, args.size, args.range[0], syms, args.output)
os.system(cmd)

View File

@@ -0,0 +1,26 @@
import os
print("Generating 12 px")
os.system("python built_in_font_gen.py --size 12 -o lv_font_roboto_12.c --bpp 4")
os.system('sed -i \'s|#include "lvgl/lvgl.h"|#include "../../lvgl.h"|\' lv_font_roboto_12.c')
print("\nGenerating 16 px")
os.system("python built_in_font_gen.py --size 16 -o lv_font_roboto_16.c --bpp 4")
os.system('sed -i \'s|#include "lvgl/lvgl.h"|#include "../../lvgl.h"|\' lv_font_roboto_16.c')
print("\nGenerating 22 px")
os.system("python built_in_font_gen.py --size 22 -o lv_font_roboto_22.c --bpp 4")
os.system('sed -i \'s|#include "lvgl/lvgl.h"|#include "../../lvgl.h"|\' lv_font_roboto_22.c')
print("\nGenerating 28 px")
os.system("python built_in_font_gen.py --size 28 -o lv_font_roboto_28.c --bpp 4")
os.system('sed -i \'s|#include "lvgl/lvgl.h"|#include "../../lvgl.h"|\' lv_font_roboto_28.c')
print("\nGenerating 12 px subpx")
os.system("python built_in_font_gen.py --size 12 -o lv_font_roboto_12_subpx.c --bpp 4 --subpx")
os.system('sed -i \'s|#include "lvgl/lvgl.h"|#include "../../lvgl.h"|\' lv_font_roboto_12_subpx.c')
print("\nGenerating 28 px compressed")
os.system("python built_in_font_gen.py --size 28 -o lv_font_roboto_28_compressed.c --bpp 4 --compressed")
os.system('sed -i \'s|#include "lvgl/lvgl.h"|#include "../../lvgl.h"|\' lv_font_roboto_28_compressed.c')