Skip to content

Commit

Permalink
修复排序
Browse files Browse the repository at this point in the history
  • Loading branch information
TakWolf committed Jul 2, 2024
1 parent 752bcac commit 1754d11
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 8 deletions.
3 changes: 1 addition & 2 deletions tools/services/font_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,8 +203,7 @@ def _get_sequence(self, width_mode: str) -> list[int]:
else:
sequence = set(self._glyph_file_registry['common'])
sequence.update(self._glyph_file_registry[width_mode])
sequence = list(sequence)
sequence.sort()
sequence = sorted(sequence)
self._sequence_pool[width_mode] = sequence
return sequence

Expand Down
7 changes: 2 additions & 5 deletions tools/services/info_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@ def _get_unicode_chr_count_infos(alphabet: set[str]) -> list[tuple[UnicodeBlock,
if not c.isprintable() and block.printable_count > 0:
continue
count_infos[block.code_start] += 1
code_starts = list(count_infos)
code_starts.sort()
return [(unidata_blocks.get_block_by_code_point(code_start), count_infos[code_start]) for code_start in code_starts]
return [(unidata_blocks.get_block_by_code_point(code_start), count) for code_start, count in sorted(count_infos.items())]


def _get_locale_chr_count_infos(alphabet: set[str], query_category_func: Callable[[str], str | None]) -> defaultdict[str, int]:
Expand Down Expand Up @@ -153,8 +151,7 @@ def make_font_info(design_context: DesignContext, width_mode: str):


def make_alphabet_txt(design_context: DesignContext, width_mode: str):
alphabet = list(design_context.get_alphabet(width_mode))
alphabet.sort()
alphabet = sorted(design_context.get_alphabet(width_mode))

path_define.outputs_dir.mkdir(parents=True, exist_ok=True)
file_path = path_define.outputs_dir.joinpath(f'alphabet-{design_context.font_config.font_size}px-{width_mode}.txt')
Expand Down
2 changes: 1 addition & 1 deletion tools/services/template_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def make_alphabet_html(design_context: DesignContext, width_mode: str):
_make_html('alphabet.html', f'alphabet-{design_context.font_config.font_size}px-{width_mode}.html', {
'font_config': design_context.font_config,
'width_mode': width_mode,
'alphabet': ''.join(sorted([c for c in design_context.get_alphabet(width_mode) if ord(c) >= 128])),
'alphabet': ''.join(sorted(c for c in design_context.get_alphabet(width_mode) if ord(c) >= 128)),
})


Expand Down

0 comments on commit 1754d11

Please sign in to comment.