-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Failed to load application font #97
Comments
@KayelynSimmons-NOAA the reason this is happening is that either the For those in who have this issue in the future, because this is a bug and needs to be adjusted, temporarily you can comment out the sys.exit(-2) calls and see if TagLab loads if __name__ == '__main__':
...
# set the application font
if platform.system() != "Darwin":
QFD = QFontDatabase()
font_id1 = QFD.addApplicationFont(os.path.join(PATH_FONTS, "opensans/OpenSans-Regular.ttf"))
if font_id1 == -1:
print("Failed to load application font..")
# sys.exit(-2) <------ Comment out
font_id2 = QFD.addApplicationFont(os.path.join(PATH_FONTS, "roboto/Roboto-Light.ttf"))
if font_id2 == -1:
print("Failed to load application font..")
# sys.exit(-2) <------ Comment out
font_id3 = QFD.addApplicationFont(os.path.join(PATH_FONTS, "roboto/Roboto-Regular.ttf"))
if font_id3 == -1:
print("Failed to load application font..")
# sys.exit(-2) <------ Comment out
font = QFont('Roboto')
app.setFont(font)
@massimomartinelli for some reason people are running into this issue, it might be worth modifying the order such that we try to load Roboto first, and if that doesn't work, then try to pull from the try:
font = QFont('Roboto')
app.setFont(font)
except Exception:
print("Failed to load native font; attempting to load from file..")
try:
QFD = QFontDatabase()
font_id1 = QFD.addApplicationFont(os.path.join(PATH_FONTS, "opensans/OpenSans-Regular.ttf"))
font_id2 = QFD.addApplicationFont(os.path.join(PATH_FONTS, "roboto/Roboto-Light.ttf"))
font_id3 = QFD.addApplicationFont(os.path.join(PATH_FONTS, "roboto/Roboto-Regular.ttf"))
font = QFont('Roboto')
app.setFont(font)
except Exception:
print("Failed to load application font..")
sys.exit(-2) |
The text was updated successfully, but these errors were encountered: