diff --git a/assets/fonts/ark-pixel/version.json b/assets/fonts/ark-pixel/version.json index 89773d61..e10c27cf 100644 --- a/assets/fonts/ark-pixel/version.json +++ b/assets/fonts/ark-pixel/version.json @@ -1,6 +1,6 @@ { - "sha": "e98678f4b5b03d99e1f00eb4d02e2dfba90e0b5a", - "version": "2024.05.12", - "version_url": "https://github.com/TakWolf/ark-pixel-font/tree/2024.05.12", - "asset_url": "https://github.com/TakWolf/ark-pixel-font/archive/e98678f4b5b03d99e1f00eb4d02e2dfba90e0b5a.zip" + "sha": "45e860d6fa8498a86c0b1fd1100c9655c5cc9a26", + "version": "develop", + "version_url": "https://github.com/TakWolf/ark-pixel-font/tree/develop", + "asset_url": "https://github.com/TakWolf/ark-pixel-font/archive/45e860d6fa8498a86c0b1fd1100c9655c5cc9a26.zip" } diff --git a/assets/patch-glyphs/10/config.toml b/assets/patch-glyphs/10/config.toml deleted file mode 100644 index f900729d..00000000 --- a/assets/patch-glyphs/10/config.toml +++ /dev/null @@ -1,14 +0,0 @@ -[font] -size = 10 - -[font.monospaced] -ascent = 9 -descent = -1 -x_height = 5 -cap_height = 7 - -[font.proportional] -ascent = 12 -descent = -4 -x_height = 5 -cap_height = 7 diff --git a/assets/patch-glyphs/10/config.yaml b/assets/patch-glyphs/10/config.yaml new file mode 100644 index 00000000..a530e2da --- /dev/null +++ b/assets/patch-glyphs/10/config.yaml @@ -0,0 +1,11 @@ +monospaced: + ascent: 9 + descent: -1 + x-height: 5 + cap-height: 7 + +proportional: + ascent: 12 + descent: -4 + x-height: 5 + cap-height: 7 diff --git a/assets/patch-glyphs/12/config.toml b/assets/patch-glyphs/12/config.toml deleted file mode 100644 index 9fd4f4c8..00000000 --- a/assets/patch-glyphs/12/config.toml +++ /dev/null @@ -1,14 +0,0 @@ -[font] -size = 12 - -[font.monospaced] -ascent = 10 -descent = -2 -x_height = 6 -cap_height = 8 - -[font.proportional] -ascent = 14 -descent = -4 -x_height = 6 -cap_height = 9 diff --git a/assets/patch-glyphs/12/config.yaml b/assets/patch-glyphs/12/config.yaml new file mode 100644 index 00000000..1fc09ef3 --- /dev/null +++ b/assets/patch-glyphs/12/config.yaml @@ -0,0 +1,11 @@ +monospaced: + ascent: 10 + descent: -2 + x-height: 6 + cap-height: 8 + +proportional: + ascent: 14 + descent: -4 + x-height: 6 + cap-height: 9 diff --git a/assets/patch-glyphs/8/config.toml b/assets/patch-glyphs/8/config.toml deleted file mode 100644 index 36c07ad7..00000000 --- a/assets/patch-glyphs/8/config.toml +++ /dev/null @@ -1,14 +0,0 @@ -[font] -size = 8 - -[font.monospaced] -ascent = 7 -descent = -1 -x_height = 4 -cap_height = 6 - -[font.proportional] -ascent = 9 -descent = -3 -x_height = 4 -cap_height = 6 diff --git a/assets/patch-glyphs/8/config.yaml b/assets/patch-glyphs/8/config.yaml new file mode 100644 index 00000000..2b5956d8 --- /dev/null +++ b/assets/patch-glyphs/8/config.yaml @@ -0,0 +1,11 @@ +monospaced: + ascent: 7 + descent: -1 + x-height: 4 + cap-height: 6 + +proportional: + ascent: 9 + descent: -3 + x-height: 4 + cap-height: 6 diff --git a/tools/configs/font.py b/tools/configs/font.py index a3f1c8d4..66ebf555 100644 --- a/tools/configs/font.py +++ b/tools/configs/font.py @@ -27,24 +27,17 @@ def load_all() -> dict[int, 'FontConfig']: @staticmethod def load(font_size: int) -> 'FontConfig': - file_path = path_define.patch_glyphs_dir.joinpath(str(font_size), 'config.toml') - config_data = fs_util.read_toml(file_path)['font'] - assert font_size == config_data['size'], f"Config 'size' error: '{file_path}'" + file_path = path_define.patch_glyphs_dir.joinpath(str(font_size), 'config.yaml') + config_data = fs_util.read_yaml(file_path) layout_params = {} - for width_mode in configs.width_modes: - layout_param_data = config_data[width_mode] - layout_param = LayoutParam( + for width_mode, layout_param_data in config_data.items(): + layout_params[width_mode] = LayoutParam( layout_param_data['ascent'], layout_param_data['descent'], - layout_param_data['x_height'], - layout_param_data['cap_height'], + layout_param_data['x-height'], + layout_param_data['cap-height'], ) - if width_mode == 'monospaced': - assert layout_param.line_height == font_size, f"Config 'monospaced.line_height' error: '{file_path}'" - else: - assert (layout_param.line_height - font_size) % 2 == 0, f"Config 'proportional.line_height' error: '{file_path}'" - layout_params[width_mode] = layout_param return FontConfig(font_size, layout_params) diff --git a/tools/services/update_service.py b/tools/services/update_service.py index 2a6d823c..7b198998 100644 --- a/tools/services/update_service.py +++ b/tools/services/update_service.py @@ -84,9 +84,11 @@ def setup_ark_pixel_glyphs(): continue shutil.copytree(source_glyphs_dir_from, source_glyphs_dir_to) - config_file_path_from = path_define.ark_pixel_glyphs_dir.joinpath(str(font_size), 'config.toml') - config_file_path_to = path_define.patch_glyphs_dir.joinpath(str(font_size), 'config.toml') - os.remove(config_file_path_to) + config_file_path_from = path_define.ark_pixel_glyphs_dir.joinpath(str(font_size), 'config.yaml') + config_file_path_to = path_define.patch_glyphs_dir.joinpath(str(font_size), 'config.yaml') + if config_file_path_to.exists(): + os.remove(config_file_path_to) + config_file_path_to.parent.mkdir(parents=True, exist_ok=True) config_file_path_from.rename(config_file_path_to) license_path_from = source_unzip_dir.joinpath('LICENSE-OFL') diff --git a/tools/utils/fs_util.py b/tools/utils/fs_util.py index a4b5ce17..ed766e7d 100644 --- a/tools/utils/fs_util.py +++ b/tools/utils/fs_util.py @@ -1,6 +1,5 @@ import json import shutil -import tomllib from pathlib import Path from typing import Any @@ -28,9 +27,5 @@ def write_json(data: Any, path: Path): path.write_text(f'{json.dumps(data, indent=2, ensure_ascii=False)}\n', 'utf-8') -def read_toml(path: Path) -> Any: - return tomllib.loads(path.read_text('utf-8')) - - def read_yaml(path: Path) -> Any: return yaml.safe_load(path.read_text('utf-8'))