Skip to content

Commit

Permalink
feat: fix tables, remove suffix from variable name
Browse files Browse the repository at this point in the history
  • Loading branch information
mishamyrt committed May 11, 2024
1 parent 1260564 commit 2037bf1
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 16 deletions.
2 changes: 1 addition & 1 deletion STAT.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"Lilex-VF.ttf":
"Lilex.ttf":
- tag: wght
name: Weight
values:
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ pylance==0.8.17
fontbakery[freetype]==0.12.5
dehinter==4.0.0
shaperglot==0.5.0
uharfbuzz==0.39.1
35 changes: 20 additions & 15 deletions scripts/builder/make.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""Make helpers"""
import subprocess as sp
from os import unlink
from os import listdir, unlink
from shutil import move, which

STAT_CONFIG = 'STAT.yaml'
Expand Down Expand Up @@ -31,40 +31,45 @@ def _fix_variable(font_dir, family_name) -> bool:
"gen-stat",
"--inplace",
f'--src "{STAT_CONFIG}"',
f'"{font_dir}/{family_name}-VF.ttf"')
f'"{font_dir}/{family_name}.ttf"')

def _fix_ttf(font_dir, family_name) -> bool:
"""Fix bold fsSelection and macStyle"""
bold_path = f'{font_dir}/{family_name}-Bold.ttf'
success = _gftools(
"fix-font",
"--include-source-fixes",
bold_path
)
if not success:
return False
unlink(bold_path)
move(f'{bold_path}.fix', bold_path)
files = listdir(font_dir)
print(files)
for file in files:
file_path = f'{font_dir}/{file}'
success = _gftools(
"fix-font",
"--include-source-fixes",
file_path
)
if not success:
return False
unlink(file_path)
move(f'{file_path}.fix', file_path)
return True

POST_FIXES = {
"ttf": _fix_ttf,
"variable": _fix_variable
}

def make(family_name: str, ds_path: str, fmt: str, out_dir: str, ) -> bool:
def make(family_name: str, ds_path: str, fmt: str, out_dir: str) -> bool:
"""Wrapper for fontmake"""
cmd = [
_which("fontmake"),
f'-m "{ds_path}"',
f'-o "{fmt}"',
f'--output-dir "{out_dir}"',
"--flatten-components",
"--autohint",
"--filter DecomposeTransformedComponentsFilter"
]
if fmt != "variable":
if fmt == "variable":
cmd.append(f'--output-path "{out_dir}/{family_name}.ttf"')
else:
cmd.append("--interpolate")
cmd.append(f'--output-dir "{out_dir}"')
success = _run(*cmd)
if not success:
return False
Expand Down

0 comments on commit 2037bf1

Please sign in to comment.