From 69206e290eb5349d82f30f2b13409b0af55fe4ef Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sat, 22 Jul 2017 18:48:23 -0700 Subject: [PATCH] [varLib] "Document" IUP DP algorithm for the case when forced set is empty --- Lib/fontTools/varLib/__init__.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Lib/fontTools/varLib/__init__.py b/Lib/fontTools/varLib/__init__.py index 0551c88aa..ae3965d09 100644 --- a/Lib/fontTools/varLib/__init__.py +++ b/Lib/fontTools/varLib/__init__.py @@ -345,6 +345,9 @@ def _iup_contour_optimize(delta, coords, tolerance=0.): delta = _rot_list(delta, -k) else: + # Repeat the contour an extra time, solve the 2*n case, then look for solutions of the + # circular n-length problem in the solution for 2*n linear case. I cannot prove that + # this always produces the optimal solution... chain, costs = _iup_contour_optimize_dp(delta+delta, coords+coords, forced, tolerance, n) best_sol, best_cost = None, n+1