mirror of
https://gitee.com/zlgopen/awtk.git
synced 2024-11-29 18:48:09 +08:00
improve build scripts
This commit is contained in:
parent
ae59dbbff2
commit
cc59835037
@ -1,5 +1,8 @@
|
|||||||
# 最新动态
|
# 最新动态
|
||||||
|
|
||||||
|
2024/02/21
|
||||||
|
* 资源配置新增STORAGE_DIR属性,用于生成位图字体资源时可通过在该属性指定的目录下获取原始字体和保留字符等文件(感谢培煌提供补丁)
|
||||||
|
|
||||||
2024/02/20
|
2024/02/20
|
||||||
* 修复拼写错误(感谢兆坤提供补丁)
|
* 修复拼写错误(感谢兆坤提供补丁)
|
||||||
* 修复android编译警告。
|
* 修复android编译警告。
|
||||||
|
@ -78,6 +78,7 @@ class res_config:
|
|||||||
inc_res = True
|
inc_res = True
|
||||||
inc_bitmap = True
|
inc_bitmap = True
|
||||||
inc_bitmap_font = True
|
inc_bitmap_font = True
|
||||||
|
storage_dir = None
|
||||||
|
|
||||||
def __init__(self) :
|
def __init__(self) :
|
||||||
self.assets = res_multidict();
|
self.assets = res_multidict();
|
||||||
@ -167,13 +168,13 @@ class res_config:
|
|||||||
|
|
||||||
def get_res_fonts_key(self, theme_name) :
|
def get_res_fonts_key(self, theme_name) :
|
||||||
if self.has_themes() :
|
if self.has_themes() :
|
||||||
return self.assets[theme_name]['fonts'].keys()
|
return self.assets['themes'][theme_name]['fonts'].keys()
|
||||||
return list()
|
return list()
|
||||||
|
|
||||||
def get_res_font_size_key(self, theme_name, font_name) :
|
def get_res_font_size_key(self, theme_name, font_name) :
|
||||||
key = []
|
key = []
|
||||||
if self.has_themes() :
|
if self.has_themes() :
|
||||||
for name in self.assets[theme_name]['fonts'][font_name].keys() :
|
for name in self.assets['themes'][theme_name]['fonts'][font_name].keys() :
|
||||||
if name != 'text' or name != 'bpp' :
|
if name != 'text' or name != 'bpp' :
|
||||||
key.append(name)
|
key.append(name)
|
||||||
return key
|
return key
|
||||||
@ -328,3 +329,7 @@ class res_config:
|
|||||||
|
|
||||||
def get_inc_bitmap_font(self) :
|
def get_inc_bitmap_font(self) :
|
||||||
return self.inc_bitmap_font
|
return self.inc_bitmap_font
|
||||||
|
|
||||||
|
def get_storage_dir(self):
|
||||||
|
return self.storage_dir
|
||||||
|
|
||||||
|
@ -77,9 +77,9 @@ def use_theme_config_from_res_config(res_config_path, config = None):
|
|||||||
font_name = common.to_file_system_coding(font_name)
|
font_name = common.to_file_system_coding(font_name)
|
||||||
font_size = common.to_file_system_coding(font_size)
|
font_size = common.to_file_system_coding(font_size)
|
||||||
filename = common.join_path(config_dir, font_name+'_'+font_size+'.txt')
|
filename = common.join_path(config_dir, font_name+'_'+font_size+'.txt')
|
||||||
common.write_file(filename, content.get_res_font_value(theme_name, font_name, font_size))
|
common.write_file(filename, content.get_res_font_value(theme_name, font_name, font_size, ''))
|
||||||
|
|
||||||
theme = {'name': theme_name, 'imagegen_options': imagegen_options, 'packaged': content.get_res_packaged(theme_name)}
|
theme = {'name': theme_name, 'imagegen_options': imagegen_options, 'packaged': content.get_res_packaged(theme_name), 'storage_dir': content.get_storage_dir()}
|
||||||
if theme_name == 'default':
|
if theme_name == 'default':
|
||||||
THEMES.insert(0, theme)
|
THEMES.insert(0, theme)
|
||||||
else:
|
else:
|
||||||
|
@ -34,6 +34,7 @@ IS_GENERATE_RAW = True
|
|||||||
IS_GENERATE_INC_RES = True
|
IS_GENERATE_INC_RES = True
|
||||||
IS_GENERATE_INC_BITMAP = True
|
IS_GENERATE_INC_BITMAP = True
|
||||||
ASSETS_SUBNAME = '__assets_'
|
ASSETS_SUBNAME = '__assets_'
|
||||||
|
STORAGE_DIR = None
|
||||||
###########################
|
###########################
|
||||||
|
|
||||||
|
|
||||||
@ -158,6 +159,7 @@ def set_current_theme(index):
|
|||||||
global IMAGEGEN_OPTIONS
|
global IMAGEGEN_OPTIONS
|
||||||
global INPUT_DIR
|
global INPUT_DIR
|
||||||
global OUTPUT_DIR
|
global OUTPUT_DIR
|
||||||
|
global STORAGE_DIR
|
||||||
|
|
||||||
if index >= len(THEMES):
|
if index >= len(THEMES):
|
||||||
return
|
return
|
||||||
@ -174,6 +176,8 @@ def set_current_theme(index):
|
|||||||
IMAGEGEN_OPTIONS = theme['imagegen_options']
|
IMAGEGEN_OPTIONS = theme['imagegen_options']
|
||||||
if 'packaged' in theme:
|
if 'packaged' in theme:
|
||||||
THEME_PACKAGED = theme['packaged']
|
THEME_PACKAGED = theme['packaged']
|
||||||
|
if 'storage_dir' in theme:
|
||||||
|
STORAGE_DIR = theme['storage_dir']
|
||||||
|
|
||||||
INPUT_DIR = join_path(ASSETS_ROOT, THEME+'/raw')
|
INPUT_DIR = join_path(ASSETS_ROOT, THEME+'/raw')
|
||||||
if not os.path.exists(INPUT_DIR):
|
if not os.path.exists(INPUT_DIR):
|
||||||
@ -613,6 +617,9 @@ def gen_res_all_xml():
|
|||||||
|
|
||||||
|
|
||||||
def gen_res_bitmap_font(input_dir, font_options, theme):
|
def gen_res_bitmap_font(input_dir, font_options, theme):
|
||||||
|
if STORAGE_DIR:
|
||||||
|
input_dir = join_path(STORAGE_DIR, theme)
|
||||||
|
|
||||||
if not os.path.exists(join_path(input_dir, 'fonts/config')):
|
if not os.path.exists(join_path(input_dir, 'fonts/config')):
|
||||||
return
|
return
|
||||||
|
|
||||||
@ -621,13 +628,14 @@ def gen_res_bitmap_font(input_dir, font_options, theme):
|
|||||||
fontname = os.path.basename(filename)
|
fontname = os.path.basename(filename)
|
||||||
index = fontname.rfind('_')
|
index = fontname.rfind('_')
|
||||||
if index > 0:
|
if index > 0:
|
||||||
raw = os.path.dirname(os.path.dirname(filename)) + '/origin/' + fontname[0 : index] + '.ttf'
|
raw = join_path(input_dir, 'fonts') + '/origin/' + fontname[0: index] + '.ttf'
|
||||||
if not os.path.exists(raw):
|
if not os.path.exists(raw):
|
||||||
raw = os.path.dirname(os.path.dirname(filename)) + '/' + fontname[0 : index] + '.ttf'
|
raw = os.path.dirname(os.path.dirname(filename)) + '/' + fontname[0: index] + '.ttf'
|
||||||
if os.path.exists(raw):
|
if os.path.exists(raw):
|
||||||
size = fontname[index + 1 : len(fontname)]
|
size = fontname[index + 1 : len(fontname)]
|
||||||
inc = join_path(OUTPUT_DIR, 'inc/fonts/' + fontname[0 : index] + '_' + str(size) + '.data')
|
if size.isdigit():
|
||||||
fontgen(raw, f, inc, size, font_options, theme)
|
inc = join_path(OUTPUT_DIR, 'inc/fonts/' + fontname[0: index] + '_' + str(size) + '.data')
|
||||||
|
fontgen(raw, f, inc, size, font_options, theme)
|
||||||
|
|
||||||
|
|
||||||
def gen_res_all_font():
|
def gen_res_all_font():
|
||||||
|
Loading…
Reference in New Issue
Block a user