from fontTools.ttLib import TTFont import os font_path = os.path.join(os.path.dirname(__file__), "..", "assets", "fonts", "NotoSansSC-Regular.ttf") font = TTFont(font_path) print("Tables:", list(font.keys())) has_glyf = "glyf" in font has_cff = "CFF " in font print(f"Has glyf (TrueType): {has_glyf}") print(f"Has CFF: {has_cff}") if has_glyf: print("TRUE TYPE FONT - OK for dart_pdf!") elif has_cff: print("CFF FONT - will FAIL with dart_pdf!") cmap = font.getBestCmap() test_chars = ["小", "妈", "厨", "房", "珍", "珠", "虾", "仁"] for c in test_chars: cp = ord(c) found = cp in cmap print(f" {c} (U+{cp:04X}): {'FOUND' if found else 'MISSING'}") font.close()