This commit is contained in:
Behdad Esfahbod 2023-11-28 10:09:23 -07:00
parent 4f914dbbc2
commit 447e8b865d
2 changed files with 29 additions and 6 deletions

View File

@ -808,8 +808,9 @@ def test_gen(
midVector = _contour_vector_from_stats(midStats) midVector = _contour_vector_from_stats(midStats)
midSize = midVector[0] * midVector[0] midSize = midVector[0] * midVector[0]
for overweight, problem_type in enumerate(("underweight", "overweight")): for overweight, problem_type in enumerate(
("underweight", "overweight")
):
if overweight: if overweight:
expectedSize = (size0 * size1) ** 0.5 expectedSize = (size0 * size1) ** 0.5
expectedSize = (size0 + size1) - expectedSize expectedSize = (size0 + size1) - expectedSize
@ -825,9 +826,10 @@ def test_gen(
size1, size1,
) )
if ( if (
(not overweight and expectedSize * tolerance > midSize + 1e-5) not overweight
or and expectedSize * tolerance > midSize + 1e-5
(overweight and 1e-5 + expectedSize < midSize * tolerance) ) or (
overweight and 1e-5 + expectedSize < midSize * tolerance
): ):
try: try:
if overweight: if overweight:
@ -1061,6 +1063,11 @@ def main(args=None):
action="store", action="store",
help="Output report in PDF format", help="Output report in PDF format",
) )
parser.add_argument(
"--ps",
action="store",
help="Output report in PostScript format",
)
parser.add_argument( parser.add_argument(
"--html", "--html",
action="store", action="store",
@ -1463,6 +1470,18 @@ def main(args=None):
if not problems and not args.quiet: if not problems and not args.quiet:
pdf.draw_cupcake() pdf.draw_cupcake()
if args.ps:
log.info("Writing PS to %s", args.pdf)
from .interpolatablePlot import InterpolatablePS
with InterpolatablePS(args.ps, glyphsets=glyphsets, names=names) as ps:
ps.add_title_page(
original_args_inputs, tolerance=tolerance, kinkiness=kinkiness
)
ps.add_problems(problems)
if not problems and not args.quiet:
ps.draw_cupcake()
if args.html: if args.html:
log.info("Writing HTML to %s", args.html) log.info("Writing HTML to %s", args.html)
from .interpolatablePlot import InterpolatableSVG from .interpolatablePlot import InterpolatableSVG

View File

@ -513,7 +513,11 @@ class InterpolatablePlot:
midway_glyphset, midway_glyphset,
glyphname, glyphname,
[{"type": "midway"}] [{"type": "midway"}]
+ [p for p in problems if p["type"] in ("kink", "underweight", "overweight")], + [
p
for p in problems
if p["type"] in ("kink", "underweight", "overweight")
],
None, None,
x=x, x=x,
y=y, y=y,