Skip to content

Commit

Permalink
Update opencc-data to 1.0.4
Browse files Browse the repository at this point in the history
  • Loading branch information
ayaka14732 committed Oct 1, 2020
1 parent f0f2f9b commit 2cdc350
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 24 deletions.
1 change: 1 addition & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ jobs:
python -m pip install -r requirements.txt
- name: Build
run: |
build/prepare.sh
python build/main.py
- name: Upload artifact
uses: actions/upload-artifact@v2
Expand Down
32 changes: 8 additions & 24 deletions build/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import os
import subprocess

FONT_VERSION = 1.002
FONT_VERSION = 1.003

# Define the max entries size in a subtable.
# We define a number that is small enough here, so that the entries will not exceed
Expand All @@ -25,21 +25,6 @@ def grouper(lst, n, start=0):
yield lst[start:start+n]
start += n

def prepare_files():
'''Download necessary files for the next steps.'''
os.system('mkdir -p output')
os.system('wget -q -nc -P cache https://github.com/ButTaiwan/genyo-font/releases/download/v1.501/GenYoMin.zip')
os.system('wget -q -nc -P cache https://cdn.jsdelivr.net/npm/opencc-data@1.0.3/data/STCharacters.txt')
os.system('wget -q -nc -P cache https://cdn.jsdelivr.net/npm/opencc-data@1.0.3/data/STPhrases.txt')
os.system('wget -q -nc -P cache https://cdn.jsdelivr.net/npm/opencc-data@1.0.3/data/TWPhrasesIT.txt')
os.system('wget -q -nc -P cache https://cdn.jsdelivr.net/npm/opencc-data@1.0.3/data/TWPhrasesName.txt')
os.system('wget -q -nc -P cache https://cdn.jsdelivr.net/npm/opencc-data@1.0.3/data/TWPhrasesOther.txt')
os.system('wget -q -nc -P cache https://cdn.jsdelivr.net/npm/opencc-data@1.0.3/data/TWVariants.txt')
os.system('cat cache/TWPhrasesIT.txt cache/TWPhrasesName.txt cache/TWPhrasesOther.txt > cache/TWPhrases.txt')
os.system('wget -q -nc -P cache https://gist.githubusercontent.com/fatum12/941a10f31ac1ad48ccbc/raw/59d7e29b307ae3439317a975ef390cd729f9bc17/ttc2ttf.pe')
os.system('wget -q -nc -P cache https://raw.githubusercontent.com/rime-aca/character_set/e7d009a8a185a83f62ad2c903565b8bb85719221/通用規範漢字表.txt')
os.system('unzip -n -d cache cache/GenYoMin.zip')

# An opentype font can hold at most 65535 glyphs.
MAX_GLYPH_COUNT = 65535

Expand Down Expand Up @@ -399,12 +384,11 @@ def go(path, twp=False):
modify_metadata(font, twp=twp)
save_font(font, build_dest_path_from_src_path(path, twp=twp))

prepare_files()

# Initialize OpenCC converters
t2s = OpenCC('t2s').convert
t2twp = OpenCC('./build/t2twp').convert
if __name__ == '__main__':
# Initialize OpenCC converters
t2s = OpenCC('t2s').convert
t2twp = OpenCC('./build/t2twp').convert

for path in glob('cache/GenYoMin-*.ttc'):
go(path)
go(path, twp=True)
for path in glob('cache/GenYoMin-*.ttc'):
go(path)
go(path, twp=True)
13 changes: 13 additions & 0 deletions build/prepare.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/sh
mkdir -p output
wget -q -nc -P cache https://github.com/ButTaiwan/genyo-font/releases/download/v1.501/GenYoMin.zip
wget -q -nc -P cache https://cdn.jsdelivr.net/npm/opencc-data@1.0.4/data/STCharacters.txt
wget -q -nc -P cache https://cdn.jsdelivr.net/npm/opencc-data@1.0.4/data/STPhrases.txt
wget -q -nc -P cache https://cdn.jsdelivr.net/npm/opencc-data@1.0.4/data/TWPhrasesIT.txt
wget -q -nc -P cache https://cdn.jsdelivr.net/npm/opencc-data@1.0.4/data/TWPhrasesName.txt
wget -q -nc -P cache https://cdn.jsdelivr.net/npm/opencc-data@1.0.4/data/TWPhrasesOther.txt
wget -q -nc -P cache https://cdn.jsdelivr.net/npm/opencc-data@1.0.4/data/TWVariants.txt
cat cache/TWPhrasesIT.txt cache/TWPhrasesName.txt cache/TWPhrasesOther.txt > cache/TWPhrases.txt
wget -q -nc -P cache https://gist.githubusercontent.com/fatum12/941a10f31ac1ad48ccbc/raw/59d7e29b307ae3439317a975ef390cd729f9bc17/ttc2ttf.pe
wget -q -nc -P cache https://raw.githubusercontent.com/rime-aca/character_set/e7d009a8a185a83f62ad2c903565b8bb85719221/通用規範漢字表.txt
unzip -q -n -d cache cache/GenYoMin.zip "*.ttc"

0 comments on commit 2cdc350

Please sign in to comment.