From c53933a9bc1306a1df88477b6cfccba980cea001 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Mon, 20 Feb 2023 15:15:00 -0700 Subject: [PATCH] [qu2cu] Adjust cost calculation again I believe I've got it right this time. Produces slightly better output. --- Lib/fontTools/qu2cu/qu2cu.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Lib/fontTools/qu2cu/qu2cu.py b/Lib/fontTools/qu2cu/qu2cu.py index 7d01f5224..8a68fe99c 100644 --- a/Lib/fontTools/qu2cu/qu2cu.py +++ b/Lib/fontTools/qu2cu/qu2cu.py @@ -221,7 +221,7 @@ def quadratic_to_curves( quads = [[complex(x, y) for (x, y) in p] for p in quads] q = [quads[0][0]] - costs = [0, 1] + costs = [1] cost = 1 for p in quads: assert q[-1] == p[0] @@ -296,7 +296,7 @@ def spline_to_curves(q, costs, tolerance=0.5, all_cubic=False): if not all_cubic: # Solution with quadratics between j:i - this_count = costs[2 * i] - costs[2 * j] + this_count = costs[2 * i - 1] - costs[2 * j] + 1 i_sol_count = j_sol_count + this_count i_sol_error = j_sol_error i_sol = Solution(i_sol_count, i_sol_error, i - j, False)