NL build in release, add suffix NL to name if disable ligature

This commit is contained in:
subframe7536 2024-12-05 01:08:08 +08:00
parent 50f5c6f25c
commit 7cefafd675
3 changed files with 22 additions and 10 deletions

View file

@ -298,10 +298,11 @@ class FontConfig:
if args.cn_narrow:
self.cn["narrow"] = True
if self.debug:
self.family_name += " Debug"
name_arr = [word.capitalize() for word in self.family_name.split(" ")]
if not self.enable_liga:
name_arr.append("NL")
if self.debug:
name_arr.append("Debug")
self.family_name = " ".join(name_arr)
self.family_name_compact = "".join(name_arr)

View file

@ -12,7 +12,7 @@ def move_and_log(file_path: str, target_path: str):
print(f"Move {file_path} -> {target_path}")
move(file_path, target_path)
def build(normal: bool, hinted: bool, cache: bool = False):
def build(normal: bool, hinted: bool, liga: bool, cache: bool = False):
args = [
"python",
"build.py",
@ -31,6 +31,11 @@ def build(normal: bool, hinted: bool, cache: bool = False):
else:
args.append("--no-hinted")
if liga:
args.append("--liga")
else:
args.append("--no-liga")
print(" ".join(args))
subprocess.run(args)
@ -53,10 +58,14 @@ rmtree(output_release, ignore_errors=True)
mkdir(output_release)
# build all formats
build(normal=True, hinted=True)
build(normal=True, hinted=False, cache=True)
build(normal=False, hinted=True)
build(normal=False, hinted=False, cache=True)
build(normal=True, liga=True, hinted=True)
build(normal=True, liga=True, hinted=False, cache=True)
build(normal=True, liga=False, hinted=True)
build(normal=True, liga=False, hinted=False, cache=True)
build(normal=False, liga=True, hinted=True)
build(normal=False, liga=True, hinted=False, cache=True)
build(normal=False, liga=False, hinted=True)
build(normal=False, liga=False, hinted=False, cache=True)
# copy woff2 to root
rmtree("woff2", ignore_errors=True)

View file

@ -48,8 +48,10 @@ def freeze_feature(font, calt, moving_rules=[], config={}):
glyph_dict = font["glyf"].glyphs
hmtx_dict = font["hmtx"].metrics
for index in target_feature.LookupListIndex:
lookup = font["GSUB"].table.LookupList.Lookup[index]
for old_key, new_key in lookup.SubTable[0].mapping.items():
lookup = font["GSUB"].table.LookupList.Lookup[index].SubTable[0].mapping
if not lookup:
continue
for old_key, new_key in lookup.items():
if (
old_key in glyph_dict
and old_key in hmtx_dict