Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rework segment_vf_collection #4966

Merged
merged 6 commits into from
Jan 22, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Lib/fontbakery/checks/opentype/STAT/ital_axis.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ def segment_vf_collection(fonts):
for font in fonts:
if "-Italic[" in font.file:
italics.append(font)
elif font.is_italic:
italics.append(font)
else:
non_italics.append(font)

Expand All @@ -109,6 +111,9 @@ def segment_vf_collection(fonts):
if non_italic.file == suspected_roman:
found_roman = non_italic
break
if non_italic.family == italic.family:
found_roman = non_italic
break

if found_roman:
non_italics.remove(found_roman)
Expand Down
17 changes: 17 additions & 0 deletions Lib/fontbakery/testable.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,23 @@ def ttFont(self):
font.ensureDecompiled()
return font

@cached_property
def family(self):
from fontbakery.utils import get_name_entry_strings
from fontbakery.constants import NameID

ttFont = self.ttFont
familynames = get_name_entry_strings(ttFont, NameID.FONT_FAMILY_NAME)
typo_familynames = get_name_entry_strings(
ttFont, NameID.TYPOGRAPHIC_FAMILY_NAME
)
if not familynames:
return None

family = typo_familynames[0] if typo_familynames else familynames[0]

return family

@cached_property
def style(self):
"""Determine font style from canonical filename."""
Expand Down
Loading