Revisión | 13 (tree) |
---|---|
Tiempo | 2015-06-09 20:57:29 |
Autor | ![]() |
・ディレクトリを自分で作るように修正
・svgをバージョンアップに必要だった
一部しかエクスポートしない設定にしていたので修正
@@ -6,7 +6,7 @@ | ||
6 | 6 | # 源柔ゴシック加工用に、源ノ角ゴシックのグリフをすべて |
7 | 7 | # svg として出力します。 |
8 | 8 | # ----------------------------------------------------------------- |
9 | -# [使用方法] rounded_exportsvg.py generate_all weight | |
9 | +# [使用方法] rounded_exportsvg.py weight | |
10 | 10 | # weight : ExtraLight, Light, Normal, Regular, Medium, Bold, Heavy |
11 | 11 | # ****************************************************************** |
12 | 12 |
@@ -397,8 +397,7 @@ | ||
397 | 397 | font = fontforge.open('output/genshingothic-%s.ttf' % (weight)) |
398 | 398 | |
399 | 399 | for g in font.glyphs(): |
400 | - # if """ generate_all or g.unicode in genelate_uni_list or """ g.glyphname in genelate_list : | |
401 | - if g.glyphname in genelate_list : | |
400 | + if generate_all or (g.unicode in genelate_uni_list) or (g.glyphname in genelate_list): | |
402 | 401 | unicode = '%05X' % g.unicode |
403 | 402 | if g.unicode < 0 : |
404 | 403 | unicode = 'FFFFF' |
@@ -405,6 +404,8 @@ | ||
405 | 404 | svgfile = 'svg/%s/%s-%s.svg' % (weight, unicode, g.glyphname) |
406 | 405 | else: |
407 | 406 | svgfile = 'svg/%s/%s.svg' % (weight, unicode) |
407 | + if not os.path.exists( os.path.dirname(svgfile) ): | |
408 | + os.makedirs( os.path.dirname(svgfile) ) | |
408 | 409 | g.export(svgfile) |
409 | 410 | f = open(svgfile) |
410 | 411 | txt = f.read() |
@@ -14,6 +14,8 @@ | ||
14 | 14 | import argparse |
15 | 15 | from mmutils import * |
16 | 16 | |
17 | +generate_all = True | |
18 | + | |
17 | 19 | notExportList = ( |
18 | 20 | "0201C", |
19 | 21 |
@@ -416,8 +418,9 @@ | ||
416 | 418 | svgfile = 'svg/%s/%s-%s.svg' % (weight, unicode, g.glyphname) |
417 | 419 | else: |
418 | 420 | svgfile = 'svg/%s/%s.svg' % (weight, unicode) |
419 | - # if """not ( unicode in notExportList ) or""" g.glyphnae in genelate_list: | |
420 | - if g.glyphname in genelate_list: | |
421 | + if not ( unicode in notExportList ) and (generate_all or (g.glyphnae in genelate_list)): | |
422 | + if not os.path.exists( os.path.dirname(svgfile) ): | |
423 | + os.makedirs( os.path.dirname(svgfile) ) | |
421 | 424 | g.export(svgfile) |
422 | 425 | f = open(svgfile) |
423 | 426 | txt = f.read() |