check font in automatic test (#698)
* check font in automatic test * fix `description` in `action.yml` * check font first because it's faster * add link to missing character * fix grammar error * fix grammar error again * fix SHA error * fix one-line error to align with github * fix: make line-number start from 1
This commit is contained in:
28
.github/actions/automatic-test/action.yml
vendored
28
.github/actions/automatic-test/action.yml
vendored
@@ -4,6 +4,34 @@ description: 'Check for obvious errors.'
|
|||||||
runs:
|
runs:
|
||||||
using: "composite"
|
using: "composite"
|
||||||
steps:
|
steps:
|
||||||
|
- name: Prepare FontTools
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
pip install fonttools
|
||||||
|
- name: Check all characters are in the font
|
||||||
|
shell: python
|
||||||
|
run: |
|
||||||
|
from fontTools.ttLib import TTFont
|
||||||
|
from pathlib import Path
|
||||||
|
from os import environ as env
|
||||||
|
|
||||||
|
font = TTFont('parts/fonts/proportional.otf')
|
||||||
|
keys = set(font.getBestCmap().keys())
|
||||||
|
|
||||||
|
missing = []
|
||||||
|
for file in Path('parts/language').glob('*.lua'):
|
||||||
|
for i, line in enumerate(file.read_text().splitlines()):
|
||||||
|
for char in line:
|
||||||
|
if ord(char) not in keys:
|
||||||
|
missing.append((char, file, i+1))
|
||||||
|
|
||||||
|
if missing:
|
||||||
|
print('Missing characters:')
|
||||||
|
for char, file, i in missing:
|
||||||
|
print(f"'{char}'({ord(char):x}) in {file} at line {i} (https://github.com/26F-Studio/Techmino/blob/{env['GITHUB_SHA']}/{file}#L{i})")
|
||||||
|
exit(1)
|
||||||
|
else:
|
||||||
|
print('All characters are present in the font.')
|
||||||
- uses: ./.github/actions/build-love
|
- uses: ./.github/actions/build-love
|
||||||
with:
|
with:
|
||||||
file-path: Techmino.love
|
file-path: Techmino.love
|
||||||
|
|||||||
Reference in New Issue
Block a user