3 # fontconfig write-35-lang-normalize-conf.py
9 print('ERROR: usage: {} ORTH_LIST [OUTPUT.CONF]'.format(sys.argv[0]))
12 orth_list_unsorted = sys.argv[1].split(',')
14 if len(sys.argv) > 2 and sys.argv[2] != '-':
15 f_out = open(sys.argv[2], 'w', encoding='utf8')
19 orth_list = sorted(sys.argv[1].split(','))
21 print('<?xml version="1.0"?>', file=f_out)
22 print('<!DOCTYPE fontconfig SYSTEM "urn:fontconfig:fonts.dtd">', file=f_out)
23 print('<fontconfig>', file=f_out)
26 print(f' <!-- {o}* -> {o} -->', file=f_out)
27 print(f' <match>', file=f_out)
28 print(f' <test name="lang" compare="contains"><string>{o}</string></test>', file=f_out)
29 print(f' <edit name="lang" mode="assign" binding="same"><string>{o}</string></edit>', file=f_out)
30 print(f' </match>', file=f_out)
32 print('</fontconfig>', file=f_out)