Python的IDLE编辑器是否使用后备字体?

时间:2017-04-12 17:29:21

标签: python fonts python-idle

我正在尝试找到一种支持IDLE似乎拥有的一系列特殊字符的字体。配置IDLE菜单似乎声称它使用Courier New。但是当我检查Courier New的内容时,它并不支持IDLE以某种方式显示的字符。 IDLE是否使用Courier New的修改版本,还是使用某种后备字体?

IDLE正在展示Courier New中的一些字符:(例如)

[("⌐■","■"),("°","°"),("⇀","↼"),("´•","•`"),("´","`"),("`","´"),("ó","ò"),("ò","ó"),("⸌","⸍"),("Ƹ̵̡","Ʒ"),("ᗒ","ᗕ"),("⟃","⟄"),("⪧","⪦"),
("⪦","⪧"),("⪩","⪨"),("⪨","⪩"),("⪰","⪯"),("⫑","⫒"),("⨴","⨵"),("⩿","⪀"),("⩾","⩽"),("⩺","⩹"),("⩹","⩺"),("◥▶","◀◤"),("◍","◎"),("⌣","⌣”"),
("͡⎚","⎚"),("≋","≋"),("૦ઁ","૦ઁ"),("ꗞ","ꗞ"),("ꔸ","ꔸ"),("꘠","꘠"),("ꖘ","ꖘ"),("܍","܍"),("ළ","ළ"),("◉","◉"),("☉","☉"),("・","・"),
("▰","▰"),("ᵔ","ᵔ"),("゚","゚"),("□","□"),("☼","☼"),("*","*"),("`","`"),("⚆","⚆"),("⊜","⊜"),(">",">"),("❍","❍"),(" ̄"," ̄"),        
("─","─"),("✿","✿"),("•","•"),("T","T"),("^","^"),("ⱺ","ⱺ"),("@","@"),("ȍ","ȍ"),("x","x"),("-","-"),("$","$"),("Ȍ","Ȍ"),("ʘ","ʘ"),
("Ꝋ","Ꝋ"),("",""),("",""),("⸟","⸟"),("๏","๏"),("ⴲ","ⴲ"),("■","■"),("゚゚"),("◕","◕"),("◔","◔"),("✧","✧"),("■","■"),("♥","♥"),
("¬","¬"),("⨶","⨶"),("⨱","⨱"),("⏓","⏓"),("⏒","⏒"),("⍜","⍜"),("⍤","⍤"),("ᚖ","ᚖ"),("ᴗ","ᴗ"),("ಠ","ಠ"),("σ","σ"),("☯","☯"),("の","の"),("¬¬"),("э","э")]

1 个答案:

答案 0 :(得分:1)

你的问题有两个问题。

  1. 如何生成字符的像素模式以及IDLE具有哪些部分?简短的回答是IDLE与生成它们无关。 IDLE使用tkinter,Python的tcl / tk GUI框架接口。 IDLE调用tkinter.font.families来获取系统上识别的字体名称列表。那些方法调用tk,它调用你的操作系统。
  2. 我认为为特定Unicode代码点显示的像素模式最终取决于您的操作系统的字体子系统,可能由tk设置的参数修改。字体类型(TrueFont或其他)也可能影响结果。

    1. 如何判断特定系统上特定字体实际可用的字符?正如您所发现的那样,操作系统可能会填充一些空白,因此您可能会获得比预期更多的空白。我推测通过“检查内容”你的意思是在一些外部引用中查找支持的字符。
    2. 目前,在IDLE上,对话框的字体测试显示仅限于ASCII的子集。要测试任何其他内容,必须在编辑器中预先生成测试选择并点击“应用”,或者通过键盘输入或打印使用unicode转义的字符串退出并测试。我希望有一天能够通过在对话框本身中增加当前动态生成的测试字符显示来改进这一点。

      编辑:我已经阅读了一个tcl unicode文档,它解释了tk尝试用小部件字体显示小部件中的每个文本字符,但如果不能,则tk尝试找到将显示字符的最佳匹配字体。由于即使在“应该”的情况下也不能保证搜索成功,因此最好指定一个字体,其中包含大多数计划使用的字符。