MetaCore-startup/tests/test_font.py
2025-10-17 16:56:28 +08:00

43 lines
1.3 KiB
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/usr/bin/env python3
"""快速检测Inter字体"""
def quick_font_check():
try:
from PyQt5.QtWidgets import QApplication
from PyQt5.QtGui import QFontDatabase, QFont, QFontInfo
import sys
app = QApplication(sys.argv)
font_db = QFontDatabase()
families = font_db.families()
# 检查Inter
inter_families = [f for f in families if 'Inter' in f]
if inter_families:
print("✅ Inter字体已安装:")
for family in inter_families:
print(f" {family}")
# 测试实际使用
test_font = QFont("Inter", 14)
font_info = QFontInfo(test_font)
print(f"\n实际使用字体: {font_info.family()}")
if "Inter" in font_info.family():
print("✅ Inter字体可正常使用")
else:
print("❌ Inter字体回退到其他字体")
else:
print("❌ Inter字体未安装")
print("请从 https://fonts.google.com/specimen/Inter 下载安装")
app.quit()
except ImportError:
print("❌ PyQt5未安装无法检测字体")
if __name__ == "__main__":
quick_font_check()