bpo-13802: Use non-Latin characters in IDLE's Font settings sample. (#3960)
Even if one selects a font that defines a limited subset of the unicode Basic Multilingual Plane, tcl/tk will use other fonts that define a character. The expanded example give users of non-Latin characters a better idea of what they might see in the IDLE shell and editors. To make room for the expanded sample, frames on the Font tab are re-arranged. The Font/Tabs help explains a bit about the additions.
This commit is contained in:
parent
884d13a55f
commit
e2e42274ee
|
@ -12,7 +12,7 @@ Refer to comments in EditorWindow autoindent code for details.
|
|||
from tkinter import (Toplevel, Listbox, Text, Scale, Canvas,
|
||||
StringVar, BooleanVar, IntVar, TRUE, FALSE,
|
||||
TOP, BOTTOM, RIGHT, LEFT, SOLID, GROOVE, NORMAL, DISABLED,
|
||||
NONE, BOTH, X, Y, W, E, EW, NS, NSEW, NW,
|
||||
NONE, BOTH, X, Y, W, E, EW, NS, NSEW, NW, CENTER,
|
||||
HORIZONTAL, VERTICAL, ANCHOR, ACTIVE, END)
|
||||
from tkinter.ttk import (Button, Checkbutton, Entry, Frame, Label, LabelFrame,
|
||||
OptionMenu, Notebook, Radiobutton, Scrollbar, Style)
|
||||
|
@ -479,7 +479,7 @@ class FontPage(Frame):
|
|||
font_size_title: Label
|
||||
(*)sizelist: DynOptionMenu - font_size
|
||||
(*)bold_toggle: Checkbutton - font_bold
|
||||
frame_font_sample: Frame
|
||||
frame_sample: LabelFrame
|
||||
(*)font_sample: Label
|
||||
frame_indent: LabelFrame
|
||||
indent_title: Label
|
||||
|
@ -490,10 +490,11 @@ class FontPage(Frame):
|
|||
self.font_bold = tracers.add(BooleanVar(self), self.var_changed_font)
|
||||
self.space_num = tracers.add(IntVar(self), ('main', 'Indent', 'num-spaces'))
|
||||
|
||||
# Create widgets:
|
||||
# body and body section frames.
|
||||
# Define frames and widgets.
|
||||
frame_font = LabelFrame(
|
||||
self, borderwidth=2, relief=GROOVE, text=' Base Editor Font ')
|
||||
self, borderwidth=2, relief=GROOVE, text=' Shell/Editor Font ')
|
||||
frame_sample = LabelFrame(
|
||||
self, borderwidth=2, relief=GROOVE, text=' Font Sample ')
|
||||
frame_indent = LabelFrame(
|
||||
self, borderwidth=2, relief=GROOVE, text=' Indentation Width ')
|
||||
# frame_font.
|
||||
|
@ -501,7 +502,7 @@ class FontPage(Frame):
|
|||
frame_font_param = Frame(frame_font)
|
||||
font_name_title = Label(
|
||||
frame_font_name, justify=LEFT, text='Font Face :')
|
||||
self.fontlist = Listbox(frame_font_name, height=5,
|
||||
self.fontlist = Listbox(frame_font_name, height=15,
|
||||
takefocus=True, exportselection=FALSE)
|
||||
self.fontlist.bind('<ButtonRelease-1>', self.on_fontlist_select)
|
||||
self.fontlist.bind('<KeyRelease-Up>', self.on_fontlist_select)
|
||||
|
@ -514,11 +515,37 @@ class FontPage(Frame):
|
|||
self.bold_toggle = Checkbutton(
|
||||
frame_font_param, variable=self.font_bold,
|
||||
onvalue=1, offvalue=0, text='Bold')
|
||||
frame_font_sample = Frame(frame_font, relief=SOLID, borderwidth=1)
|
||||
# frame_sample.
|
||||
sample = (
|
||||
'<ASCII/Latin1>\n'
|
||||
'AaBbCcDdEeFfGgHhIiJj\n1234567890#:+=(){}[]\n'
|
||||
'\u00a2\u00a3\u00a5\u00a7\u00a9\u00ab\u00ae\u00b6\u00bd\u011e'
|
||||
'\u00c0\u00c1\u00c2\u00c3\u00c4\u00c5\u00c7\u00d0\u00d8\u00df\n'
|
||||
'\n<IPA,Greek,Cyrillic>\n'
|
||||
'\u0250\u0255\u0258\u025e\u025f\u0264\u026b\u026e\u0270\u0277'
|
||||
'\u027b\u0281\u0283\u0286\u028e\u029e\u02a2\u02ab\u02ad\u02af\n'
|
||||
'\u0391\u03b1\u0392\u03b2\u0393\u03b3\u0394\u03b4\u0395\u03b5'
|
||||
'\u0396\u03b6\u0397\u03b7\u0398\u03b8\u0399\u03b9\u039a\u03ba\n'
|
||||
'\u0411\u0431\u0414\u0434\u0416\u0436\u041f\u043f\u0424\u0444'
|
||||
'\u0427\u0447\u042a\u044a\u042d\u044d\u0460\u0464\u046c\u04dc\n'
|
||||
'\n<Hebrew, Arabic>\n'
|
||||
'\u05d0\u05d1\u05d2\u05d3\u05d4\u05d5\u05d6\u05d7\u05d8\u05d9'
|
||||
'\u05da\u05db\u05dc\u05dd\u05de\u05df\u05e0\u05e1\u05e2\u05e3\n'
|
||||
'\u0627\u0628\u062c\u062f\u0647\u0648\u0632\u062d\u0637\u064a'
|
||||
'\u0660\u0661\u0662\u0663\u0664\u0665\u0666\u0667\u0668\u0669\n'
|
||||
'\n<Devanagari, Tamil>\n'
|
||||
'\u0966\u0967\u0968\u0969\u096a\u096b\u096c\u096d\u096e\u096f'
|
||||
'\u0905\u0906\u0907\u0908\u0909\u090a\u090f\u0910\u0913\u0914\n'
|
||||
'\u0be6\u0be7\u0be8\u0be9\u0bea\u0beb\u0bec\u0bed\u0bee\u0bef'
|
||||
'\u0b85\u0b87\u0b89\u0b8e\n'
|
||||
'\n<East Asian>\n'
|
||||
'\u3007\u4e00\u4e8c\u4e09\u56db\u4e94\u516d\u4e03\u516b\u4e5d\n'
|
||||
'\u6c49\u5b57\u6f22\u5b57\u4eba\u6728\u706b\u571f\u91d1\u6c34\n'
|
||||
'\uac00\ub0d0\ub354\ub824\ubaa8\ubd64\uc218\uc720\uc988\uce58\n'
|
||||
'\u3042\u3044\u3046\u3048\u304a\u30a2\u30a4\u30a6\u30a8\u30aa\n'
|
||||
)
|
||||
temp_font = tkFont.Font(self, ('courier', 10, 'normal'))
|
||||
self.font_sample = Label(
|
||||
frame_font_sample, justify=LEFT, font=temp_font,
|
||||
text='AaBbCcDdEe\nFfGgHhIiJj\n1234567890\n#:+=(){}[]')
|
||||
self.font_sample = Label(frame_sample, text=sample, font=temp_font)
|
||||
# frame_indent.
|
||||
indent_title = Label(
|
||||
frame_indent, justify=LEFT,
|
||||
|
@ -527,10 +554,12 @@ class FontPage(Frame):
|
|||
frame_indent, variable=self.space_num,
|
||||
orient='horizontal', tickinterval=2, from_=2, to=16)
|
||||
|
||||
# Pack widgets:
|
||||
# body.
|
||||
frame_font.pack(side=LEFT, padx=5, pady=5, expand=TRUE, fill=BOTH)
|
||||
frame_indent.pack(side=LEFT, padx=5, pady=5, fill=Y)
|
||||
# Grid and pack widgets:
|
||||
self.columnconfigure(1, weight=1)
|
||||
frame_font.grid(row=0, column=0, padx=5, pady=5)
|
||||
frame_sample.grid(row=0, column=1, rowspan=2, padx=5, pady=5,
|
||||
sticky='nsew')
|
||||
frame_indent.grid(row=1, column=0, padx=5, pady=5, sticky='ew')
|
||||
# frame_font.
|
||||
frame_font_name.pack(side=TOP, padx=5, pady=5, fill=X)
|
||||
frame_font_param.pack(side=TOP, padx=5, pady=5, fill=X)
|
||||
|
@ -540,10 +569,9 @@ class FontPage(Frame):
|
|||
font_size_title.pack(side=LEFT, anchor=W)
|
||||
self.sizelist.pack(side=LEFT, anchor=W)
|
||||
self.bold_toggle.pack(side=LEFT, anchor=W, padx=20)
|
||||
frame_font_sample.pack(side=TOP, padx=5, pady=5, expand=TRUE, fill=BOTH)
|
||||
# frame_sample.
|
||||
self.font_sample.pack(expand=TRUE, fill=BOTH)
|
||||
# frame_indent.
|
||||
frame_indent.pack(side=TOP, fill=X)
|
||||
indent_title.pack(side=TOP, anchor=W, padx=5)
|
||||
self.indent_scale.pack(side=TOP, padx=5, fill=X)
|
||||
|
||||
|
@ -2108,10 +2136,24 @@ When you click either the Apply or Ok buttons, settings in this
|
|||
dialog that are different from IDLE's default are saved in
|
||||
a .idlerc directory in your home directory. Except as noted,
|
||||
these changes apply to all versions of IDLE installed on this
|
||||
machine. Some do not take affect until IDLE is restarted.
|
||||
[Cancel] only cancels changes made since the last save.
|
||||
machine. [Cancel] only cancels changes made since the last save.
|
||||
'''
|
||||
help_pages = {
|
||||
'Fonts/Tabs':'''
|
||||
Font sample: This shows what a selection of Basic Multilingual Plane
|
||||
unicode characters look like for the current font selection. If the
|
||||
selected font does not define a character, Tk attempts to find another
|
||||
font that does. Substitute glyphs depend on what is available on a
|
||||
particular system and will not necessarily have the same size as the
|
||||
font selected. Line contains 20 characters up to Devanagari, 14 for
|
||||
Tamil, and 10 for East Asia.
|
||||
|
||||
Hebrew and Arabic letters should display right to left, starting with
|
||||
alef, \u05d0 and \u0627. Arabic digits display left to right. The
|
||||
Devanagari and Tamil lines start with digits. The East Asian lines
|
||||
are Chinese digits, Chinese Hanzi, Korean Hangul, and Japanese
|
||||
Hiragana and Katakana.
|
||||
''',
|
||||
'Highlights': '''
|
||||
Highlighting:
|
||||
The IDLE Dark color theme is new in October 2015. It can only
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
Use non-Latin characters in the IDLE's Font settings sample.
|
||||
|
||||
Even if one selects a font that defines a limited subset of the unicode
|
||||
|
||||
Basic Multilingual Plane, tcl/tk will use other fonts that define a
|
||||
|
||||
character. The expanded example give users of non-Latin characters
|
||||
|
||||
a better idea of what they might see in IDLE's shell and editors.
|
||||
|
||||
|
||||
|
||||
To make room for the expanded sample, frames on the Font tab are
|
||||
|
||||
re-arranged. The Font/Tabs help explains a bit about the additions.
|
Loading…
Reference in New Issue