I'm using Windows 11 and python 3.11.1. Some unicode characters change look depending on which character is used first in tkinter per font. The code below show the behavior:
import tkinter as tk
from tkinter.font import Font
app = tk.Tk()
tk.Label(app, text="\u25b6 \u23EE \u270E", font=Font()).pack(side="top")
tk.Label(app, text="\u23EE \u25b6 \u270E", font=Font()).pack(side="top")
app.mainloop()
The output is the following:
Why does this happen? Is there a way to set the default look of characters in a font without adding a temporary character first?
CodePudding user response:
I did some tests and eventually when trying unicode characters with Google Chrome I realized that this issue has nothing to do with tkinter or Python. It seems to be a larger problem with unicode characters in general. Here is what happens if you play around with the following unicode characters (⏮▶▶) in google chrome search bar.
Edit:
As Mike 'Pomax' Kamermans pointed out, this problem does not appear when using a font that supports all unicode characters that are used. For example GNU Unifont, http://unifoundry.com/unifont/, supports the unicode characters mentioned in the question and the shape for those characters are always the same when using that font.
The most probable reason this happens is depending on which unicode character is first used then different fallback fonts are used and therefore the shape may differ.