From 1962f6f7343000aa145276b9b035ea4b666e385d Mon Sep 17 00:00:00 2001 From: TakWolf Date: Mon, 25 Nov 2024 05:23:10 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=20mapping=20=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E7=9B=AE=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/fonts/ark-pixel/version.json | 4 ++-- tools/cli.py | 6 ++++-- tools/configs/path_define.py | 1 + tools/services/font_service.py | 5 ++--- tools/services/update_service.py | 5 +++-- 5 files changed, 12 insertions(+), 9 deletions(-) diff --git a/assets/fonts/ark-pixel/version.json b/assets/fonts/ark-pixel/version.json index f7391ef..bd2abfe 100644 --- a/assets/fonts/ark-pixel/version.json +++ b/assets/fonts/ark-pixel/version.json @@ -1,6 +1,6 @@ { - "sha": "c53fe806c9c62cda40ca5c126dead019b7a8eb30", + "sha": "75f8b5021ec06f5049bb2fc6ebc7adcdf16a812e", "version": "develop", "version_url": "https://github.com/TakWolf/ark-pixel-font/tree/develop", - "asset_url": "https://github.com/TakWolf/ark-pixel-font/archive/c53fe806c9c62cda40ca5c126dead019b7a8eb30.zip" + "asset_url": "https://github.com/TakWolf/ark-pixel-font/archive/75f8b5021ec06f5049bb2fc6ebc7adcdf16a812e.zip" } diff --git a/tools/cli.py b/tools/cli.py index 71aed47..da11e78 100644 --- a/tools/cli.py +++ b/tools/cli.py @@ -60,8 +60,10 @@ def main( update_service.setup_ark_pixel_glyphs() mappings = [ - glyph_mapping_util.load_mapping(path_define.ark_pixel_glyphs_dir.joinpath('cjk-radicals-supplement-mapping.yml')), - glyph_mapping_util.load_mapping(path_define.ark_pixel_glyphs_dir.joinpath('kangxi-radicals-mapping.yml')), + glyph_mapping_util.load_mapping(path_define.ark_pixel_mappings_dir.joinpath('0370-03FF-Greek-and-Coptic.yml')), + glyph_mapping_util.load_mapping(path_define.ark_pixel_mappings_dir.joinpath('0400-04FF-Cyrillic.yml')), + glyph_mapping_util.load_mapping(path_define.ark_pixel_mappings_dir.joinpath('2E80-2EFF-CJK-Radicals-Supplement.yml')), + glyph_mapping_util.load_mapping(path_define.ark_pixel_mappings_dir.joinpath('2F00-2FDF-Kangxi-Radicals.yml')), ] dump_configs = DumpConfig.load() fallback_configs = FallbackConfig.load() diff --git a/tools/configs/path_define.py b/tools/configs/path_define.py index 1d0eb36..7e96176 100644 --- a/tools/configs/path_define.py +++ b/tools/configs/path_define.py @@ -10,6 +10,7 @@ cache_dir = project_root_dir.joinpath('cache') downloads_dir = cache_dir.joinpath('downloads') ark_pixel_glyphs_dir = cache_dir.joinpath('ark-pixel-glyphs') +ark_pixel_mappings_dir = cache_dir.joinpath('ark-pixel-mappings') build_dir = project_root_dir.joinpath('build') dump_dir = build_dir.joinpath('dump') diff --git a/tools/services/font_service.py b/tools/services/font_service.py index c94ec8d..a025fd8 100644 --- a/tools/services/font_service.py +++ b/tools/services/font_service.py @@ -25,9 +25,8 @@ def load(font_config: FontConfig, mappings: list[dict[int, SourceFlavorGroup]]) context.update(glyph_file_util.load_context(path_define.patch_glyphs_dir.joinpath(str(font_config.font_size), width_mode_dir_name))) contexts[width_mode_dir_name] = context - if width_mode_dir_name == 'common': - for mapping in mappings: - glyph_mapping_util.apply_mapping(context, mapping) + for mapping in mappings: + glyph_mapping_util.apply_mapping(context, mapping) for flavor_group in context.values(): if 'zh_cn' in flavor_group: diff --git a/tools/services/update_service.py b/tools/services/update_service.py index 31917ba..8b9d464 100644 --- a/tools/services/update_service.py +++ b/tools/services/update_service.py @@ -75,12 +75,13 @@ def setup_ark_pixel_glyphs(): if path_define.ark_pixel_glyphs_dir.exists(): shutil.rmtree(path_define.ark_pixel_glyphs_dir) + if path_define.ark_pixel_mappings_dir.exists(): + shutil.rmtree(path_define.ark_pixel_mappings_dir) for font_size in [10, 12]: shutil.copyfile(source_unzip_dir.joinpath('assets', 'glyphs', str(font_size), 'config.yml'), path_define.patch_glyphs_dir.joinpath(str(font_size), 'config.yml')) shutil.copyfile(source_unzip_dir.joinpath('LICENSE-OFL'), font_ark_pixel_dir.joinpath('LICENSE.txt')) source_unzip_dir.joinpath('assets', 'glyphs').rename(path_define.ark_pixel_glyphs_dir) - source_unzip_dir.joinpath('assets', 'cjk-radicals-supplement-mapping.yml').rename(path_define.ark_pixel_glyphs_dir.joinpath('cjk-radicals-supplement-mapping.yml')) - source_unzip_dir.joinpath('assets', 'kangxi-radicals-mapping.yml').rename(path_define.ark_pixel_glyphs_dir.joinpath('kangxi-radicals-mapping.yml')) + source_unzip_dir.joinpath('assets', 'mappings').rename(path_define.ark_pixel_mappings_dir) if source_unzip_dir.exists(): shutil.rmtree(source_unzip_dir)