Skip to content

Commit 2cdc350

Browse files
committed
Update opencc-data to 1.0.4
1 parent f0f2f9b commit 2cdc350

3 files changed

Lines changed: 22 additions & 24 deletions

File tree

.github/workflows/build.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ jobs:
2323
python -m pip install -r requirements.txt
2424
- name: Build
2525
run: |
26+
build/prepare.sh
2627
python build/main.py
2728
- name: Upload artifact
2829
uses: actions/upload-artifact@v2

build/main.py

Lines changed: 8 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import os
88
import 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.
4429
MAX_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)

build/prepare.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/bin/sh
2+
mkdir -p output
3+
wget -q -nc -P cache https://github.com/ButTaiwan/genyo-font/releases/download/v1.501/GenYoMin.zip
4+
wget -q -nc -P cache https://cdn.jsdelivr.net/npm/opencc-data@1.0.4/data/STCharacters.txt
5+
wget -q -nc -P cache https://cdn.jsdelivr.net/npm/opencc-data@1.0.4/data/STPhrases.txt
6+
wget -q -nc -P cache https://cdn.jsdelivr.net/npm/opencc-data@1.0.4/data/TWPhrasesIT.txt
7+
wget -q -nc -P cache https://cdn.jsdelivr.net/npm/opencc-data@1.0.4/data/TWPhrasesName.txt
8+
wget -q -nc -P cache https://cdn.jsdelivr.net/npm/opencc-data@1.0.4/data/TWPhrasesOther.txt
9+
wget -q -nc -P cache https://cdn.jsdelivr.net/npm/opencc-data@1.0.4/data/TWVariants.txt
10+
cat cache/TWPhrasesIT.txt cache/TWPhrasesName.txt cache/TWPhrasesOther.txt > cache/TWPhrases.txt
11+
wget -q -nc -P cache https://gist.githubusercontent.com/fatum12/941a10f31ac1ad48ccbc/raw/59d7e29b307ae3439317a975ef390cd729f9bc17/ttc2ttf.pe
12+
wget -q -nc -P cache https://raw.githubusercontent.com/rime-aca/character_set/e7d009a8a185a83f62ad2c903565b8bb85719221/通用規範漢字表.txt
13+
unzip -q -n -d cache cache/GenYoMin.zip "*.ttc"

0 commit comments

Comments
 (0)