Skip to content

apply MacOS custom fonts PR#2575 from customtkinter#14

Merged
FedericoSpada merged 4 commits into
FedericoSpada:masterfrom
ajkessel:macos-custom-fonts
Jun 20, 2026
Merged

apply MacOS custom fonts PR#2575 from customtkinter#14
FedericoSpada merged 4 commits into
FedericoSpada:masterfrom
ajkessel:macos-custom-fonts

Conversation

@ajkessel

Copy link
Copy Markdown
Contributor

This applies TomSchimansky/CustomTkinter#2575 to the latest code.

@ajkessel

ajkessel commented Jun 18, 2026

Copy link
Copy Markdown
Contributor Author

Sample code using free font downloaded into local user's library from https://itch.io/queue/c/1986458/fonts-creative-commons-zero-v10-universal

import customtkinter

def button_callback():
        print("button clicked")

app = customtkinter.CTk()
app.geometry("400x150")

button = customtkinter.CTkButton(app, text="my button", command=button_callback, font=('HomeVideo-Regular',14))
button.pack(padx=20, pady=20)

button_y = customtkinter.CTkButton(app, text="normal button", command=button_callback)
button_y.pack(padx=20, pady=20)

app.mainloop()
Image

@FedericoSpada

Copy link
Copy Markdown
Owner

Can you delete BaseShape.preferred_drawing_method = "font" altogether from .../core_rendering/__init__.py and change the attribute definition in draw_engine.py from

preferred_drawing_method: ClassVar[DrawingMethodType] = "circles"

to

preferred_drawing_method: ClassVar[DrawingMethodType] = "font"

Thanks!

@ajkessel

ajkessel commented Jun 18, 2026

Copy link
Copy Markdown
Contributor Author

I made that edit. This is a screenshot with the patch at low resolution. I also reverted to Python 3.14 / Tk 8.6.

image

Without the patch:

image

I'm not really able to see the difference.

Here they are on the screen at once (old code on top, new code on the bottom):

image

@FedericoSpada

Copy link
Copy Markdown
Owner

It really seems that on macOS, the anti-aliasing is applied with the polygon method too.
Let's do this way: please revert the changes to core_rendering/__init__.py and draw_engine.py, and leave only the actual implementation for reading custom fonts.
If someone wants to change the method, they can do so, but for now, it's better to leave the default method unchanged.
Thanks!

@ajkessel

Copy link
Copy Markdown
Contributor Author

OK, all set.

@FedericoSpada FedericoSpada merged commit 484a0c7 into FedericoSpada:master Jun 20, 2026
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.

2 participants