4 # Copyright © 2011 Nick Bowler
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
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.
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.
17 import fontforge as ff
21 families = [ "M+1M+IPAG", "M+2M+IPAG" ]
22 scripts = [ "hani", "kana" ]
24 for family in families:
25 font = ff.open(family + ".ttf")
27 font.familyname = re.sub(r"(\d)M", r"\1T", font.familyname)
28 font.fontname = font.familyname + "-Regular"
29 font.fullname = font.familyname + " Regular"
31 for glyph in font.selection.all().byGlyphs:
33 if (glyph.script == s):
34 glyph.transform(psMat.scale(1.35))
36 print "Generating " + font.familyname + ".ttf"
37 font.generate(font.familyname + ".ttf")