]> git.draconx.ca Git - scripts.git/blob - mplus-t-gen.py
Add script to convert "JWK"-format RSA keys to normal.
[scripts.git] / mplus-t-gen.py
1 #!/usr/bin/env python
2 # coding=utf-8
3 #
4 # Copyright © 2011, 2018 Nick Bowler
5 #
6 # Generates new M+ fonts with the CJK characters enlarged, based on the IPAG
7 # versions.  This gives better proportions relative to DejaVu Sans Mono in
8 # rxvt-unicode.
9 #
10 # Run this script in a directory containing the M+ fonts.  The new fonts will
11 # be called M+1T+IPAG and M+2T+IPAG.
12 #
13 # License WTFPL2: Do What The Fuck You Want To Public License, version 2.
14 # This is free software: you are free to do what the fuck you want to.
15 # There is NO WARRANTY, to the extent permitted by law.
16
17 import fontforge as ff
18 import psMat
19 import re
20
21 families = [ "M+1M+IPAG", "M+2M+IPAG" ]
22 scripts  = [ "hani", "kana" ]
23
24 for family in families:
25         font = ff.open(family + ".ttf")
26
27         font.familyname = re.sub(r"(\d)M", r"\1T", font.familyname)
28         font.fontname   = font.familyname + "-Regular"
29         font.fullname   = font.familyname + " Regular"
30
31         for glyph in font.selection.all().byGlyphs:
32                 for s in scripts:
33                         if (glyph.script == s):
34                                 glyph.transform(psMat.scale(1.25))
35
36         print("Generating %s.ttf" % (font.familyname))
37         font.generate(font.familyname + ".ttf")
38         font.close()