77import os
88import subprocess
99
10- FONT_VERSION = 1.002
10+ FONT_VERSION = 1.003
1111
1212# Define the max entries size in a subtable.
1313# We define a number that is small enough here, so that the entries will not exceed
@@ -25,21 +25,6 @@ def grouper(lst, n, start=0):
2525 yield lst [start :start + n ]
2626 start += n
2727
28- def prepare_files ():
29- '''Download necessary files for the next steps.'''
30- os .system ('mkdir -p output' )
31- os .system ('wget -q -nc -P cache https://github.com/ButTaiwan/genyo-font/releases/download/v1.501/GenYoMin.zip' )
32- os .system ('wget -q -nc -P cache https://cdn.jsdelivr.net/npm/opencc-data@1.0.3/data/STCharacters.txt' )
33- os .system ('wget -q -nc -P cache https://cdn.jsdelivr.net/npm/opencc-data@1.0.3/data/STPhrases.txt' )
34- os .system ('wget -q -nc -P cache https://cdn.jsdelivr.net/npm/opencc-data@1.0.3/data/TWPhrasesIT.txt' )
35- os .system ('wget -q -nc -P cache https://cdn.jsdelivr.net/npm/opencc-data@1.0.3/data/TWPhrasesName.txt' )
36- os .system ('wget -q -nc -P cache https://cdn.jsdelivr.net/npm/opencc-data@1.0.3/data/TWPhrasesOther.txt' )
37- os .system ('wget -q -nc -P cache https://cdn.jsdelivr.net/npm/opencc-data@1.0.3/data/TWVariants.txt' )
38- os .system ('cat cache/TWPhrasesIT.txt cache/TWPhrasesName.txt cache/TWPhrasesOther.txt > cache/TWPhrases.txt' )
39- os .system ('wget -q -nc -P cache https://gist.githubusercontent.com/fatum12/941a10f31ac1ad48ccbc/raw/59d7e29b307ae3439317a975ef390cd729f9bc17/ttc2ttf.pe' )
40- os .system ('wget -q -nc -P cache https://raw.githubusercontent.com/rime-aca/character_set/e7d009a8a185a83f62ad2c903565b8bb85719221/通用規範漢字表.txt' )
41- os .system ('unzip -n -d cache cache/GenYoMin.zip' )
42-
4328# An opentype font can hold at most 65535 glyphs.
4429MAX_GLYPH_COUNT = 65535
4530
@@ -399,12 +384,11 @@ def go(path, twp=False):
399384 modify_metadata (font , twp = twp )
400385 save_font (font , build_dest_path_from_src_path (path , twp = twp ))
401386
402- prepare_files ()
403-
404- # Initialize OpenCC converters
405- t2s = OpenCC ('t2s' ).convert
406- t2twp = OpenCC ('./build/t2twp' ).convert
387+ if __name__ == '__main__' :
388+ # Initialize OpenCC converters
389+ t2s = OpenCC ('t2s' ).convert
390+ t2twp = OpenCC ('./build/t2twp' ).convert
407391
408- for path in glob ('cache/GenYoMin-*.ttc' ):
409- go (path )
410- go (path , twp = True )
392+ for path in glob ('cache/GenYoMin-*.ttc' ):
393+ go (path )
394+ go (path , twp = True )
0 commit comments