-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtoDynamicFont.py
34 lines (30 loc) · 1.07 KB
/
toDynamicFont.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import argparse
import repo
import util
lookup_col = 'Size (points)'
table = repo.FONT
if __name__ == "__main__":
parser = argparse.ArgumentParser(
description='Print font information based on size')
parser.add_argument('size', type=int, nargs='?', help='font size')
args = parser.parse_args()
if args.size is None:
size = input("Enter the size (point) or type 'exit' to quit: ")
else:
size = args.size
while True:
if size == 'exit':
break
try:
size = int(size)
except ValueError:
size = input("\nInvalid input. Please enter a number or 'exit': ")
continue
if size in [value[lookup_col] for value in table.values()]:
for key, value in table.items():
if value[lookup_col] == int(size):
util.print_column(key, value)
break
else:
util.print_column_with_closest_property_in(table.items(), lookup_col, size)
size = input("\nEnter the size (point) or type 'exit' to quit: ")