diff --git a/font_collector/font.py b/font_collector/font.py index 3cfba26..a147033 100644 --- a/font_collector/font.py +++ b/font_collector/font.py @@ -302,6 +302,16 @@ def get_missing_glyphs(self, text: Sequence[str]) -> Set[str]: if cmap_encoding == "unicode": codepoint = ord(char) else: + if cmap_encoding == "unknown" and platform_id == 3 and encoding_id == 0: + cmap_encoding = FontParser.get_symbol_cmap_encoding(face) + + if cmap_encoding is None: + # Fallback if guess fails + cmap_encoding = "cp1252" + else: + # cmap not supported + continue + try: codepoint = int.from_bytes(char.encode(cmap_encoding), "big") except UnicodeEncodeError: diff --git a/font_collector/font_parser.py b/font_collector/font_parser.py index 6ee4be4..4f54f08 100644 --- a/font_collector/font_parser.py +++ b/font_collector/font_parser.py @@ -52,7 +52,7 @@ class FontParser: 0: "mac_roman", }, 3: { # Microsoft - 0: "unicode", + 0: "unknown", 1: "unicode", 2: "cp932", 3: "cp936",