This commit is contained in:
Lee Minseo 2022-10-23 18:32:37 +09:00
parent bc7fa8563d
commit 6dd54df9b4
3 changed files with 36 additions and 2 deletions

View File

@ -40,6 +40,9 @@ jobs:
pip3 install afdko
echo "$HOME/.local/bin" >> $GITHUB_PATH
- name: Set up BeautifulSoup
run: pip3 install bs4
- name: Clean up distribution files
run: |
rm -rf dist/*.bdf
@ -92,6 +95,9 @@ jobs:
- name: Make zip
run: zip -r Galmuri-v${{ steps.package-version.outputs.current-version }}.zip dist
- name: Update progress
run: python files/updateChar.py
- name: Release
uses: softprops/action-gh-release@v1
with:

View File

@ -46,7 +46,6 @@
<div class="container">
<div class="doc">
<h2>문자 집합별 지원 현황</h2>
<p>모두 불러오는 데 시간이 좀 걸립니다…</p>
<h3>Galmuri14</h3>
<ul>
<li id="Galmuri14_hangul">Hangul Syllables: <span></span> <span></span></li>
@ -133,7 +132,6 @@
</ul>
</div>
</div>
<script src="./files/char.js"></script>
</body>
</html>

30
files/updateChar.py Normal file
View File

@ -0,0 +1,30 @@
#!/usr/bin/env python
import os
import re
from bs4 import BeautifulSoup
fonts = ['Galmuri14', 'Galmuri11', 'Galmuri11-Bold', 'Galmuri11-Condensed', 'Galmuri9', 'Galmuri7']
chars = ['hangul', 'ksx1001', 'ksc5601', 'cp949', 'jis0201', 'jis0208', 'jis0212', 'shiftjis', 'cp932']
for font in fonts:
with open(os.getcwd() + '/dist/' + font + '.bdf', 'rt', encoding='utf8') as f:
fontArr = re.findall(r'^STARTCHAR U\+([\d\w]{4})', f.read(), re.MULTILINE)
available = len(set(fontArr))
for char in chars:
with open(os.getcwd() + '/files/charsets/' + char + '.txt', 'rt', encoding='utf8') as c:
if char == 'hangul':
charArr = re.findall(r'^\d{1,5}\t(?:-|[\d\w]{4})\t(?:-|[\d\w]{4})\t(?:-|[\d\w]{4})\t(?:-|[\d\w]{4})\t(?:-|[\d\w]{4})\t([\d\w]{4})', c.read(), re.MULTILINE)
else:
charArr = re.findall(r'^0x[\d\w]{2,4}(?:\t|\s{2})0x([\d\w]{4})', c.read(), re.MULTILINE)
all = len(set(charArr))
with open(os.getcwd() + '/charsets.html', 'rt', encoding='utf8') as h:
bs = BeautifulSoup(h.read(), 'html.parser')
bs.select_one('#' + font + '_' + char + '>span:first-child').string = str(available) + ' / ' + str(all)
bs.select_one('#' + font + '_' + char + '>span:last-child').string = str(round(available / all * 100, 3)) + ' %'
bs.select_one('style').append('#' + font + '_' + char + '::before{width:' + str(available / all * 100) + '%}')
with open(os.getcwd() + '/charsets.html', 'wt', encoding='utf8') as h:
h.write(str(bs))