python 3.10.2抗脱氧字体在susi linux下未平滑的抗脱氧字体

发布于 2025-01-27 07:15:12 字数 1362 浏览 2 评论 0原文

我的字体平滑又名抗氧化无效,我有问题。我提供了一个小的TKINTER测试代码段,该代码段显示了使用该字体类型的face逐步浏览所有已安装字体的TKINTER标签。在我们当前构建Python 3.10.2 TKINTER 8.6下运行代码时,在Susi Linux下运行。我得到了字体名称的网格,但它们显然没有使用抗声明。非常锯齿。

当我在Mac上运行相同的代码时,字体是预期的。我现在认为这是由于Python本身和/或TKINTER的安装问题。我花了很多时间在网上搜索有关Python 3.10.2安装的任何信息,这些信息将打开反相关,因为它显然在我们的Linux构建下不工作。不幸的是,我必须找出问题,并指导我的IT组如何修复构建,因为我无法控制安装。

任何想法/技巧和/或在哪里寻找此问题的答案将不胜感激。 FWIW抗偏置适用于我们的Python 3.6.0在相同的Linux环境下构建,因此3.10.2构建和/或TKINTER安装的安装有些问题。

请注意,使用抗恶化字体而不是如何使该功能从根本上使用,这些现有的堆栈溢出发布在此主题地址上出现。即使我不认为我的代码段不需要我的代码段,但以防万一。

import tkinter
from tkinter import font

root = tkinter.Tk()
root.geometry('1500x1500')
root.columnconfigure(0, minsize=25)
root.columnconfigure(1, minsize=70)

tkinter.Label(root, text='Lists:', anchor=tkinter.W).grid(row=0, column=0, sticky=tkinter.W)

fams = font.families(root)

for i in range(39):
    root.rowconfigure(i, minsize=14)
col = 0
row = 1

for i, fam in enumerate(fams):
    label_id = tkinter.Label(root, anchor=tkinter.W, text=f'Sector {i}')
    print(f'({i}: {row}, {col})')
    label_id.grid(row=row, column=col )

    label_name = tkinter.Label(root, anchor=tkinter.W, font=(fam, 14), text=fam)
    c2 = col + 1
    print(f'({i}: {row}, {c2}) FAM: {fam}')
    label_name.grid(row=row, column=c2)

    row += 1
    if row % 40 == 0:
        row = 1
        col += 2
    
root.mainloop()

I have a problem with font smoothing AKA anti-aliasing not working. I have provided a small Tkinter test code snippet that shows a grid of Tkinter labels that steps through all of the installed fonts using that font's type face below. When run the code under our current build of Python 3.10.2 Tkinter 8.6 running under SUSI Linux. I get a grid of font names but they are clearly not using anti-aliasing. Very jagged.

When I run the same code on my Mac the fonts are smooth as expected. I now believe that this is due to an installation problem for either Python itself and/or Tkinter. I have spent a lot of time searching the Net for any information regarding installation settings/flags for Python 3.10.2 installation that would turn on anti-aliasing because it is clearly not operating under our Linux build. Unfortunately I have to figure out the problem and guide my IT group on how to fix the build because I do not control the installations.

Any ideas/trick and/or where to look for answers for this problem would be greatly appreciated. FWIW anti-aliasing works for our Python 3.6.0 build under the same Linux environment so there is something specifically wrong with the 3.10.2 build and/or the Tkinter installation for same.

Note all of the existing Stack Overflow postings that come up on this topic address using anti-aliased fonts not how to get the feature to fundamentally work. Even though I don't think my code snippet is needed I've included below just in case.

import tkinter
from tkinter import font

root = tkinter.Tk()
root.geometry('1500x1500')
root.columnconfigure(0, minsize=25)
root.columnconfigure(1, minsize=70)

tkinter.Label(root, text='Lists:', anchor=tkinter.W).grid(row=0, column=0, sticky=tkinter.W)

fams = font.families(root)

for i in range(39):
    root.rowconfigure(i, minsize=14)
col = 0
row = 1

for i, fam in enumerate(fams):
    label_id = tkinter.Label(root, anchor=tkinter.W, text=f'Sector {i}')
    print(f'({i}: {row}, {col})')
    label_id.grid(row=row, column=col )

    label_name = tkinter.Label(root, anchor=tkinter.W, font=(fam, 14), text=fam)
    c2 = col + 1
    print(f'({i}: {row}, {c2}) FAM: {fam}')
    label_name.grid(row=row, column=c2)

    row += 1
    if row % 40 == 0:
        row = 1
        col += 2
    
root.mainloop()

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文