Skip to content
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

Bug: Finding Fonts on Window Machines #143

Open
Jordan-Pierce opened this issue Jun 13, 2024 · 0 comments
Open

Bug: Finding Fonts on Window Machines #143

Jordan-Pierce opened this issue Jun 13, 2024 · 0 comments

Comments

@Jordan-Pierce
Copy link
Contributor

Jordan-Pierce commented Jun 13, 2024

For posterity:

It seems like on some Windows machines (specifically, NOAA), font folder's contents cannot be found, and TagLab.py cannot open properly. The issue has to do with finding the path to the folders? But, it works on most Window machines, so it's probably some default configuration on some machines with regards to paths. Below is the original code; although PATH_FONTS can be found by os.path.exists, the fond_idx is not coming back as a valid number <1, causing the script to not run.

Temporary fix is removing the if statements and just use Roboto by default.

    # 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)

        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)

        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)

        font = QFont('Roboto')
        app.setFont(font)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant