From 7980707fe27238ef76c283610ddb3b11585e25bd Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Thu, 14 Dec 2023 09:15:19 -0700 Subject: [PATCH] [interpolatable] Add Summary page to the front --- Lib/fontTools/varLib/interpolatable.py | 3 ++- Lib/fontTools/varLib/interpolatablePlot.py | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Lib/fontTools/varLib/interpolatable.py b/Lib/fontTools/varLib/interpolatable.py index c39aa1b38..fcff89c38 100644 --- a/Lib/fontTools/varLib/interpolatable.py +++ b/Lib/fontTools/varLib/interpolatable.py @@ -1099,11 +1099,12 @@ def main(args=None): doc.add_title_page( original_args_inputs, tolerance=tolerance, kinkiness=kinkiness ) + if problems: + doc.add_summary(problems) doc.add_problems(problems) if not problems and not args.quiet: doc.draw_cupcake() if problems: - doc.add_summary() doc.add_index() doc.add_table_of_contents() diff --git a/Lib/fontTools/varLib/interpolatablePlot.py b/Lib/fontTools/varLib/interpolatablePlot.py index d5925fab0..bf4ad30e5 100644 --- a/Lib/fontTools/varLib/interpolatablePlot.py +++ b/Lib/fontTools/varLib/interpolatablePlot.py @@ -348,7 +348,7 @@ class InterpolatablePlot: self.draw_label("Parameters:", x=x, y=y, width=width, bold=True) y -= self.pad + self.line_height - def add_summary(self): + def add_summary(self, problems): self.set_size(self.total_width(), self.total_height()) pad = self.pad @@ -356,11 +356,11 @@ class InterpolatablePlot: height = self.total_height() - 2 * self.pad x = y = pad - self.draw_label("Summary", x=x, y=y, bold=True, width=width) + self.draw_label("Summary of problems", x=x, y=y, bold=True, width=width) y += self.line_height glyphs_per_problem = defaultdict(set) - for glyphname, problems in self.toc.values(): + for glyphname, problems in sorted(problems.items()): for problem in problems: glyphs_per_problem[problem["type"]].add(glyphname)