[interpolatable] Reduce DEFAULT_KINKINESS_LENGTH again :(
Means more kinks. But this was necessary to get EBGaramond-Italic glyph "F" to show the really bad kinks.
This commit is contained in:
parent
8ec28bcafa
commit
79522fcd31
@ -26,7 +26,7 @@ log = logging.getLogger("fontTools.varLib.interpolatable")
|
|||||||
|
|
||||||
DEFAULT_TOLERANCE = 0.95
|
DEFAULT_TOLERANCE = 0.95
|
||||||
DEFAULT_KINKINESS = 0.5
|
DEFAULT_KINKINESS = 0.5
|
||||||
DEFAULT_KINKINESS_LENGTH = 0.01 # ratio of UPEM
|
DEFAULT_KINKINESS_LENGTH = 0.001 # ratio of UPEM
|
||||||
DEFAULT_UPEM = 1000
|
DEFAULT_UPEM = 1000
|
||||||
|
|
||||||
|
|
||||||
@ -859,16 +859,15 @@ def test_gen(
|
|||||||
d1_prev = pt1 - pt1_prev
|
d1_prev = pt1 - pt1_prev
|
||||||
d1_next = pt1_next - pt1
|
d1_next = pt1_next - pt1
|
||||||
|
|
||||||
cross0 = d0_prev.real * d0_next.imag - d0_prev.imag * d0_next.real
|
sin0 = d0_prev.real * d0_next.imag - d0_prev.imag * d0_next.real
|
||||||
cross1 = d1_prev.real * d1_next.imag - d1_prev.imag * d1_next.real
|
sin1 = d1_prev.real * d1_next.imag - d1_prev.imag * d1_next.real
|
||||||
|
|
||||||
try:
|
try:
|
||||||
cross0 /= abs(d0_prev) * abs(d0_next)
|
sin0 /= abs(d0_prev) * abs(d0_next)
|
||||||
cross1 /= abs(d1_prev) * abs(d1_next)
|
sin1 /= abs(d1_prev) * abs(d1_next)
|
||||||
except ZeroDivisionError:
|
except ZeroDivisionError:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if abs(cross0) > t or abs(cross1) > t:
|
if abs(sin0) > t or abs(sin1) > t:
|
||||||
# Not colinear / not smooth.
|
# Not colinear / not smooth.
|
||||||
continue
|
continue
|
||||||
|
|
||||||
@ -890,20 +889,20 @@ def test_gen(
|
|||||||
mid_prev = (pt0_prev + pt1_prev) / 2
|
mid_prev = (pt0_prev + pt1_prev) / 2
|
||||||
mid_next = (pt0_next + pt1_next) / 2
|
mid_next = (pt0_next + pt1_next) / 2
|
||||||
|
|
||||||
cross_mid = (mid - mid_prev).real * (mid_next - mid).imag - (
|
mid_d0 = mid - mid_prev
|
||||||
mid - mid_prev
|
mid_d1 = mid_next - mid
|
||||||
).imag * (mid_next - mid).real
|
|
||||||
|
|
||||||
|
sin_mid = mid_d0.real * mid_d1.imag - mid_d0.imag * mid_d1.real
|
||||||
try:
|
try:
|
||||||
cross_mid /= abs(mid - mid_prev) * abs(mid_next - mid)
|
sin_mid /= abs(mid_d0) * abs(mid_d1)
|
||||||
except ZeroDivisionError:
|
except ZeroDivisionError:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if abs(cross_mid) * (tolerance * kinkiness) <= t:
|
if abs(sin_mid) * (tolerance * kinkiness) <= t:
|
||||||
# Smooth / not a kink.
|
# Smooth enough.
|
||||||
continue
|
continue
|
||||||
|
|
||||||
this_tolerance = t / (abs(cross_mid) * kinkiness)
|
this_tolerance = t / (abs(sin_mid) * kinkiness)
|
||||||
|
|
||||||
yield (
|
yield (
|
||||||
glyph_name,
|
glyph_name,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user