33from fontTools .ttLib import TTFont
44import os
55
6+
67def open_font ():
78 file_path = filedialog .askopenfilename (defaultextension = ".ttf" ,
89 filetypes = [("Font" , "*.ttf *.otf" ),
@@ -11,7 +12,7 @@ def open_font():
1112 font = TTFont (file_path )
1213 characters = font ['cmap' ].getBestCmap ().keys ()
1314 valid_characters = set ()
14- with open ('Unicode/UnicodeData.txt' , 'r' ) as f :
15+ with open ('Unicode/UnicodeData.txt' , 'r' , encoding = 'utf-8' ) as f :
1516 lines = f .readlines ()
1617 index = 0
1718 while index < len (lines ):
@@ -30,7 +31,7 @@ def open_font():
3031 valid_characters .add (code )
3132 index += 1
3233 blocks_info = {}
33- with open ('Unicode/Blocks.txt' , 'r' ) as f :
34+ with open ('Unicode/Blocks.txt' , 'r' , encoding = 'utf-8' ) as f :
3435 for line in f :
3536 if line .startswith ('#' ) or not line .strip ():
3637 continue
@@ -90,7 +91,7 @@ def open_font():
9091unicode_text_box .grid (row = 3 , column = 0 , padx = 10 )
9192
9293unicode_scroll_y = tk .Scrollbar (root , orient = 'vertical' ,
93- command = unicode_text_box .yview )
94+ command = unicode_text_box .yview )
9495unicode_scroll_y .grid (row = 3 , column = 1 , sticky = 'ns' )
9596unicode_text_box .config (yscrollcommand = unicode_scroll_y .set )
9697
@@ -101,7 +102,7 @@ def open_font():
101102custom_text_box .grid (row = 3 , column = 2 , padx = 10 )
102103
103104custom_scroll_y = tk .Scrollbar (root , orient = 'vertical' ,
104- command = custom_text_box .yview )
105+ command = custom_text_box .yview )
105106custom_scroll_y .grid (row = 3 , column = 3 , sticky = 'ns' )
106107custom_text_box .config (yscrollcommand = custom_scroll_y .set )
107108
0 commit comments