Merge pull request #3364 from fonttools/interpolatable-remake
Interpolatable remake
This commit is contained in:
commit
9994829fdb
@ -322,8 +322,10 @@ def test_gen(
|
||||
|
||||
# If contour-order is wrong, adjust it
|
||||
matching = matchings[m1idx]
|
||||
if matching is not None and m1: # m1 is empty for composite glyphs
|
||||
m1 = [m1[i] for i in matching]
|
||||
if (
|
||||
matching is not None and m1Isomorphisms
|
||||
): # m1 is empty for composite glyphs
|
||||
m1Isomorphisms = [m1Isomorphisms[i] for i in matching]
|
||||
m1Vectors = [m1Vectors[i] for i in matching]
|
||||
m1VectorsNormalized = [m1VectorsNormalized[i] for i in matching]
|
||||
recording1 = [recording1[i] for i in matching]
|
||||
|
@ -107,6 +107,7 @@ class InterpolatablePlot:
|
||||
/O\
|
||||
/ \
|
||||
"""
|
||||
yay = r""" \o/ """
|
||||
|
||||
def __init__(self, out, glyphsets, names=None, **kwargs):
|
||||
self.out = out
|
||||
@ -501,7 +502,6 @@ class InterpolatablePlot:
|
||||
if any(
|
||||
pt
|
||||
in (
|
||||
"nothing",
|
||||
"wrong_start_point",
|
||||
"contour_order",
|
||||
"kink",
|
||||
@ -677,6 +677,8 @@ class InterpolatablePlot:
|
||||
emoticon = self.underweight
|
||||
elif "overweight" in problem_types:
|
||||
emoticon = self.overweight
|
||||
elif "nothing" in problem_types:
|
||||
emoticon = self.yay
|
||||
self.draw_emoticon(emoticon, x=x, y=y)
|
||||
|
||||
if show_page_number:
|
||||
@ -1062,7 +1064,7 @@ class InterpolatablePlot:
|
||||
font_ascent = font_extents[0]
|
||||
for line in text:
|
||||
extents = cr.text_extents(line)
|
||||
text_width = max(text_width, extents.width)
|
||||
text_width = max(text_width, extents.x_advance)
|
||||
text_height += font_line_height
|
||||
if not text_width:
|
||||
return
|
||||
|
@ -9,7 +9,7 @@ def test_starting_point(glyph0, glyph1, ix, tolerance, matching):
|
||||
m0Vectors = glyph0.greenVectors
|
||||
m1Vectors = [glyph1.greenVectors[i] for i in matching]
|
||||
|
||||
starting_point = 0
|
||||
proposed_point = 0
|
||||
reverse = False
|
||||
min_cost = first_cost = 1
|
||||
|
||||
@ -96,7 +96,10 @@ def test_starting_point(glyph0, glyph1, ix, tolerance, matching):
|
||||
min_cost_idx, min_cost = min(enumerate(costs), key=lambda x: x[1])
|
||||
first_cost = costs[0]
|
||||
if min_cost < first_cost * tolerance:
|
||||
this_tolerance = min_cost / first_cost
|
||||
proposed_point = new_contour1[min_cost_idx][1]
|
||||
# Don't report this
|
||||
# min_cost = first_cost
|
||||
# reverse = False
|
||||
# proposed_point = 0 # new_contour1[min_cost_idx][1]
|
||||
pass
|
||||
|
||||
return starting_point, reverse, min_cost, first_cost
|
||||
return proposed_point, reverse, min_cost, first_cost
|
||||
|
Loading…
x
Reference in New Issue
Block a user