Skip to content

Commit

Permalink
[mac_fonts.py] Lower extension
Browse files Browse the repository at this point in the history
  • Loading branch information
moi15moi committed Apr 29, 2023
1 parent a3c95a8 commit 87edb90
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions find_system_fonts_filename/mac_fonts.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class MacFonts(SystemFonts):
# CoreText has an API to get the format of the font: https://developer.apple.com/documentation/coretext/ctfontformat
# But, the API is "semi-broken" since it says .dfont are TrueType. This is kinda true, but it is not a behaviour that we want.
# So, we only check the file extension and see if it is valid.
VALID_FONT_FORMATS = ["ttf", "ttc", "otf"]
VALID_FONT_FORMATS = ["ttf", "otf", "ttc"]

def get_system_fonts_filename() -> Set[str]:
if MacVersionHelpers.is_mac_version_or_greater(10, 6):
Expand All @@ -36,7 +36,7 @@ def get_system_fonts_filename() -> Set[str]:
if no_error:
filename = file_name_ptr.value.decode()

if Path(filename).suffix.lstrip(".").strip() in MacFonts.VALID_FONT_FORMATS:
if Path(filename).suffix.lstrip(".").strip().lower() in MacFonts.VALID_FONT_FORMATS:
fonts_filename.add(filename)
else:
raise Exception("An unexpected error has occurred while decoded the CFURL.")
Expand Down

0 comments on commit 87edb90

Please sign in to comment.