It looks like you're new here. Sign in or register to get started.
harmonize_contours, harmonize_handles_contours, tunnify_contours, inflection_contours, harmonize_glyphs, harmonize_handles_glyphs, tunnify_glyphs, inflection_glyphs
<code> fontforge.registerMenuItem(harmonize_glyphs,are_glyphs_selected,None,"Font",None,"Harmonize");......<br>def modify_glyphs(junk,font,action):<br>...<br>def harmonize_glyphs(junk,font):<br> modify_glyphs(junk,font,"harmonize")<br>...<br>if fontforge.hasUserInterface():<br>
<div>...<br></div>def modify_glyphs(action,font):<br>...<br>if fontforge.hasUserInterface():<br> fontforge.registerMenuItem(modify_glyphs,are_glyphs_selected,"harmonize","Font",None,"Harmonize");<br>...
In automated processes one will still need a script in order to add points of inflection.
I have never claimed any of these contours to be perfect. The non-horizontal-or-vertical node on the dot contour should demonstrate that the tools will work for such nodes, too.
@ivan louette I think I have figured out what probably happend: You inserted an inflection point at the end of a contour. This led to a problem because the end node is identical with the start node. I have fixed this bug now. I hope it will work now for you.
@AbrahamLee Unfortunately, there are hardly any plugins of FontForge available. I have only found the plugin in the FontForge documentation and those of David Crossland (which were worth a lot for me because the documentation is so sparse).
I am looking forward to the publication of your scripts.
cdef double harmonize_distance(cPoint &p0, cPoint &p1, cPoint &p2) nogil: cdef: double i = p2.x - p1.x double j = p2.y - p1.y return fabs((((p0.y - p1.y) * i) - ((p0.x - p1.x) * j)) / sqrt(pow(i, 2) + pow(j, 2)))cdef cPoint harmonize_cubic(cCurve &curve, cCurve &next_curve) nogil: if curve.p2.x == next_curve.p1.x and curve.p2.y == next_curve.p1.y: return curve.p3 cdef: double d0 = harmonize_distance(curve.p1, curve.p2, next_curve.p1) double d1 = harmonize_distance(next_curve.p2, curve.p2, next_curve.p1) if d0 == d1: return Point(.5 * (curve.p2.x + next_curve.p1.x), .5 * (curve.p2.y + next_curve.p1.y), 0) cdef: double t = (d0 - sqrt(d0 * d1)) / (d0 - d1) double t_1 = 1 - t return Point(t_1 * curve.p2.x + t * next_curve.p1.x, t_1 * curve.p2.y + t * next_curve.p1.y, 0)