-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathmake_bold.py
38 lines (27 loc) · 1.25 KB
/
make_bold.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import configparser
import fontforge
settings = configparser.ConfigParser()
settings.read("build.ini", encoding="utf-8")
SOURCE_FONTS_DIR = settings.get("DEFAULT", "SOURCE_FONTS_DIR")
def main():
radon_jp_font = fontforge.open(f"{SOURCE_FONTS_DIR}/KiwiMaru-Medium.ttf")
krypton_jp_font = fontforge.open(f"{SOURCE_FONTS_DIR}/Stick-Regular.ttf")
print("***** Radon用の太字フォントを作成します *****")
for i, glyph in enumerate(radon_jp_font.glyphs()):
if i % 100 == 0:
print(f"{i}文字目を処理中")
if glyph.isWorthOutputting():
glyph.stroke("circular", 35, removeinternal=True, removeoverlap="none")
glyph.removeOverlap()
print("***** Krypton用の太字フォントを作成します *****")
for i, glyph in enumerate(krypton_jp_font.glyphs()):
if i % 100 == 0:
print(f"{i}文字目を処理中")
if glyph.isWorthOutputting():
glyph.stroke("circular", 38, removeinternal=True, removeoverlap="none")
glyph.removeOverlap()
# ttfファイルを保存
radon_jp_font.generate(f"{SOURCE_FONTS_DIR}/KiwiMaru-Bold.ttf")
krypton_jp_font.generate(f"{SOURCE_FONTS_DIR}/Stick-Bold.ttf")
if __name__ == "__main__":
main()