Skip to content

Commit 84bc024

Browse files
committed
Replace casefold with lower
1 parent 3d7c718 commit 84bc024

8 files changed

Lines changed: 13 additions & 13 deletions

font_collector/ass/abc_ass_document.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ def get_line_style_name(self, i: int) -> str:
118118
# VSFilter set style name to default if empty: https://sourceforge.net/p/guliverkli2/code/HEAD/tree/src/subtitles/STS.cpp#l1892
119119
# If the case for "Default" is different (ex: "deFaulT"), VSFilter force it to be "Default": https://sourceforge.net/p/guliverkli2/code/HEAD/tree/src/subtitles/STS.cpp#l1491
120120
line_style_name = line_style_name.lstrip("\t ").lstrip("*")
121-
if len(line_style_name) == 0 or line_style_name.casefold() == "default":
121+
if len(line_style_name) == 0 or line_style_name.lower() == "default":
122122
line_style_name = "Default"
123123
return line_style_name
124124

font_collector/ass/ass_style.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,15 @@ def fontname(self, value: str) -> None:
4141
def __eq__(self, other: object) -> bool:
4242
if not isinstance(other, AssStyle):
4343
return False
44-
return (self.fontname.casefold(), self.weight, self.italic) == (
45-
other.fontname.casefold(),
44+
return (self.fontname.lower(), self.weight, self.italic) == (
45+
other.fontname.lower(),
4646
other.weight,
4747
other.italic,
4848
)
4949

5050

5151
def __hash__(self) -> int:
52-
return hash((self.fontname.casefold(), self.weight, self.italic))
52+
return hash((self.fontname.lower(), self.weight, self.italic))
5353

5454

5555
def __repr__(self) -> str:

font_collector/font/font_loader.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ def load_additional_fonts(additional_fonts_path: Iterable[Path], scan_subdirs: b
102102
A list of FontFile objects representing the loaded fonts.
103103
"""
104104
def is_file_font(file_name: Path) -> bool:
105-
return file_name.suffix.lstrip(".").strip().casefold() in ["ttf", "otf", "ttc", "otc"]
105+
return file_name.suffix.lstrip(".").strip().lower() in ["ttf", "otf", "ttc", "otc"]
106106

107107
additional_fonts: list[FontFile] = []
108108

font_collector/font/font_parser.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -483,7 +483,7 @@ def get_symbol_cmap_encoding(face: FT_Face) -> Optional[str]:
483483

484484
if error:
485485
continue
486-
font_glyph_names.add(buffer.value.decode("ascii").casefold())
486+
font_glyph_names.add(buffer.value.decode("ascii").lower())
487487

488488
count_codepage: dict[str, int] = {}
489489
for code_page, glyph_names in UNIQUE_ADOBE_GLYPH_NAME_BY_CODE_PAGE.items():

font_collector/font/selection_strategy/font_selection_strategy_libass.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ class FontSelectionStrategyLibass(FontSelectionStrategy):
1616
"""
1717

1818
def is_font_name_match(self, font_face: ABCFontFace, style_font_name: str) -> bool:
19-
family_name_match = any(style_font_name.casefold() == family_name.value.casefold() for family_name in font_face.family_names)
19+
family_name_match = any(style_font_name.lower() == family_name.value.lower() for family_name in font_face.family_names)
2020

2121
if not family_name_match:
22-
exact_name_match = any(style_font_name.casefold() == exact_name.value.casefold() for exact_name in font_face.exact_names)
22+
exact_name_match = any(style_font_name.lower() == exact_name.value.lower() for exact_name in font_face.exact_names)
2323

2424
return family_name_match or exact_name_match
2525

font_collector/font/selection_strategy/font_selection_strategy_vsfilter.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ def __trunc_name(self, name: str) -> bytes:
3434

3535

3636
def is_font_name_match(self, font_face: ABCFontFace, style_font_name: str) -> bool:
37-
family_name_match = any(self.__trunc_name(style_font_name.casefold()) == self.__trunc_name(family_name.value.casefold()) for family_name in font_face.family_names)
37+
family_name_match = any(self.__trunc_name(style_font_name.lower()) == self.__trunc_name(family_name.value.lower()) for family_name in font_face.family_names)
3838

3939
if not family_name_match:
40-
exact_name_match = any(self.__trunc_name(style_font_name.casefold()) == self.__trunc_name(exact_name.value.casefold()) for exact_name in font_face.exact_names)
40+
exact_name_match = any(self.__trunc_name(style_font_name.lower()) == self.__trunc_name(exact_name.value.lower()) for exact_name in font_face.exact_names)
4141

4242
return family_name_match or exact_name_match

font_collector/parse_arguments.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@ def __parse_input_file(ass_input: list[Path]) -> list[Path]:
1212
ass_files_path = []
1313
for input in ass_input:
1414
if input.is_file():
15-
if input.suffix.casefold() == ".ass":
15+
if input.suffix.lower() == ".ass":
1616
ass_files_path.append(input)
1717
else:
1818
raise FileExistsError("Error: The input file is not an .ass file.")
1919
elif input.is_dir():
2020
for file in input.iterdir():
21-
if file.suffix.casefold() == ".ass":
21+
if file.suffix.lower() == ".ass":
2222
ass_files_path.append(file)
2323
else:
2424
raise FileNotFoundError(

proof/[Symbol Font] Find unique char by ansi code page.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def generate_unique_adobe_glyph_name_by_code_page(unique_char_by_code_page: dict
4848
for legacy_adobe_glyph_name, adobe_codepoints in LEGACY_AGL2UV.items():
4949
for adobe_codepoint in adobe_codepoints:
5050
if adobe_codepoint == ord(char):
51-
unique_adobe_glyph_name_by_code_page[codepoint].add(legacy_adobe_glyph_name.casefold())
51+
unique_adobe_glyph_name_by_code_page[codepoint].add(legacy_adobe_glyph_name.lower())
5252
found = True
5353

5454
if not found:

0 commit comments

Comments
 (0)