Skip to content

Commit

Permalink
优化错误检查消息提示:同一个 unicode 不同风格字形的 bitmap 不能相同
Browse files Browse the repository at this point in the history
  • Loading branch information
TakWolf committed Nov 7, 2024
1 parent c5ed5c7 commit 2500153
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions tools/services/check_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,12 @@ def check_glyph_files(font_config: FontConfig):
block = unidata_blocks.get_block_by_code_point(code_point)
east_asian_width = unicodedata.east_asian_width(chr(code_point))

bitmap_strings = set()
bitmap_strings = {}
for glyph_file in set(flavor_group.values()):
bitmap_string = str(glyph_file.bitmap)
assert bitmap_string not in bitmap_strings, f"[{font_config.font_size}px] duplicate glyph bitmaps: '{glyph_file.file_path}'"
bitmap_strings.add(bitmap_string)
duplicate_glyph_file = bitmap_strings.get(bitmap_string, None)
assert duplicate_glyph_file is None, f"[{font_config.font_size}px] duplicate glyph bitmaps:\n'{glyph_file.file_path}'\n'{duplicate_glyph_file.file_path}'"
bitmap_strings[bitmap_string] = glyph_file

if width_mode_dir_name == 'common' or width_mode_dir_name == 'monospaced':
assert glyph_file.height == font_config.font_size, f"[{font_config.font_size}px] glyph bitmap error: '{glyph_file.file_path}'"
Expand Down

0 comments on commit 2500153

Please sign in to comment.