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

Add feature allows user to set the fallback/customisable font list #154

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

Bob-YsPan
Copy link

I add a load_fallback_list(list) function to let the user set up a fallback font list to apply the appropriate font for each platform.
If user do not use the load_fallback_list() function, it will apply the package's default fallback font list (current list is common fonts used for traditional Chinese system first, and Segoe UI font at the last).

The project that uses the forked package is bob_db5_toolbox_git. There are two images, the first is using the current sv_ttk package's theme and shows the ui with traditional Chinese texts:

05

The button's font seems not better when the text is displayed in Chinese, and this is the image using the forked package and with the fallback list starting with the Microsoft JhengHei UI(微軟正黑體) font:
Here is my project code's current main window creation code:

    root = tk.Tk()
    root.title(TEXTS["title"])
    root.geometry("800x450")
    # Load the fallback font list
    sv_ttk.load_fallback_list([
        "微軟正黑體",
        "Microsoft JhengHei UI",
        "蘋方-繁",
        "Noto Sans CJK TC",
        "Segoe UI"
    ])
    # Set default theme
    sv_ttk.set_theme("dark")

The image:

05_N

The font looks more better when applied the fallback font list, and if the program that run on the Linux that not have the Microsoft JhengHei UI font, it will select the Noto Sans CJK TC font at the fourth of the list.

And maybe users can applied the different font list when the system is at others language! (Not tested yet)

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

Successfully merging this pull request may close these issues.

1 participant