Skip to content

Commit d9da286

Browse files
committed
Opportunistic black
1 parent 30baede commit d9da286

File tree

1 file changed

+29
-25
lines changed

1 file changed

+29
-25
lines changed

Lib/gftools/scripts/ttf2cp.py

+29-25
Original file line numberDiff line numberDiff line change
@@ -27,31 +27,35 @@
2727
from gfsubsets import CodepointsInFont, SubsetsForCodepoint
2828

2929

30-
parser = argparse.ArgumentParser(description='Dump codepoints in a font')
31-
parser.add_argument('--show_char', action='store_true',help='Print the actual character')
32-
parser.add_argument('--show_subsets', action='store_true',help='Print what subsets, if any, char is in')
33-
parser.add_argument('font', metavar='TTF', nargs="+",help='font files')
30+
parser = argparse.ArgumentParser(description="Dump codepoints in a font")
31+
parser.add_argument(
32+
"--show_char", action="store_true", help="Print the actual character"
33+
)
34+
parser.add_argument(
35+
"--show_subsets", action="store_true", help="Print what subsets, if any, char is in"
36+
)
37+
parser.add_argument("font", metavar="TTF", nargs="+", help="font files")
3438

3539

3640
def main(args=None):
37-
args = parser.parse_args(args)
38-
39-
cps = set()
40-
for filename in args.font:
41-
if not os.path.isfile(filename):
42-
sys.exit('%s is not a file' % filename)
43-
cps |= CodepointsInFont(filename)
44-
45-
for cp in sorted(cps):
46-
show_char = ''
47-
if args.show_char:
48-
show_char = (' ' + chr(cp).strip() + ' ' +
49-
unicodedata.name(chr(cp), ''))
50-
show_subset = ''
51-
if args.show_subsets:
52-
show_subset = ' subset:%s' % ','.join(SubsetsForCodepoint(cp))
53-
54-
print(u'0x%04X%s%s' % (cp, show_char, show_subset))
55-
56-
if __name__ == '__main__':
57-
main()
41+
args = parser.parse_args(args)
42+
43+
cps = set()
44+
for filename in args.font:
45+
if not os.path.isfile(filename):
46+
sys.exit("%s is not a file" % filename)
47+
cps |= CodepointsInFont(filename)
48+
49+
for cp in sorted(cps):
50+
show_char = ""
51+
if args.show_char:
52+
show_char = " " + chr(cp).strip() + " " + unicodedata.name(chr(cp), "")
53+
show_subset = ""
54+
if args.show_subsets:
55+
show_subset = " subset:%s" % ",".join(SubsetsForCodepoint(cp))
56+
57+
print("0x%04X%s%s" % (cp, show_char, show_subset))
58+
59+
60+
if __name__ == "__main__":
61+
main()

0 commit comments

Comments
 (0)