Skip to content

Commit

Permalink
Add a location for error reporting
Browse files Browse the repository at this point in the history
  • Loading branch information
simoncozens committed Aug 18, 2022
1 parent 201142a commit 2302b77
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Lib/fontTools/feaLib/ast.py
Expand Up @@ -2289,7 +2289,7 @@ def __init__(
self.conditions = conditions

def build(self, builder) -> None:
builder.add_conditionset(self.name, self.conditions)
builder.add_conditionset(self.location, self.name, self.conditions)

def asFea(self, indent="") -> str:
res = indent + f"conditionset {self.name} " + "{\n"
Expand Down
10 changes: 8 additions & 2 deletions Lib/fontTools/feaLib/builder.py
Expand Up @@ -1765,10 +1765,16 @@ def add_hhea_field(self, key, value):
def add_vhea_field(self, key, value):
self.vhea_[key] = value

def add_conditionset(self, key: str, value: Dict[str, Tuple[float, float]]):
def add_conditionset(
self,
location: FeatureLibLocation,
key: str,
value: Dict[str, Tuple[float, float]],
):
if not "fvar" in self.font:
raise FeatureLibError(
"Cannot add feature variations to a font without an 'fvar' table"
"Cannot add feature variations to a font without an 'fvar' table",
location,
)

# Normalize
Expand Down

0 comments on commit 2302b77

Please sign in to comment.