MFEK / stroke

A utility for stroking paths in font glyphs (UFO .glif) written in Rust.
Apache License 2.0
22 stars 0 forks source link

Open paths are force closed #3

Closed ctrlcctrlv closed 3 years ago

ctrlcctrlv commented 3 years ago

@MatthewBlanchard

My biggest issue is that open paths, which begin with a "move", which we would expect almost all input paths to be, are being force closed.

E.g., 22.glif:

<?xml version="1.0" encoding="UTF-8"?>
<glyph name="22" format="2">
  <advance width="0"/>
  <outline>
    <contour>
      <point x="0.000976562" y="232.347" type="move" smooth="yes"/>
      <point x="0.000976562" y="232.347"/>
      <point x="249.481" y="372.828"/>
      <point x="369.762" y="494.454" type="curve" smooth="yes"/>
      <point x="490.039" y="616.081"/>
      <point x="501.757" y="644.366"/>
      <point x="469.701" y="672.651" type="curve" smooth="yes"/>
      <point x="437.646" y="700.936"/>
      <point x="384.846" y="638.707"/>
      <point x="361.276" y="569.882" type="curve" smooth="yes"/>
      <point x="337.703" y="501.054"/>
      <point x="235.877" y="310.602"/>
      <point x="214.194" y="273.831" type="curve" smooth="yes"/>
      <point x="192.508" y="237.061"/>
      <point x="115.193" y="83.3789"/>
      <point x="108.595" y="67.3516" type="curve" smooth="yes"/>
      <point x="101.996" y="51.3223"/>
      <point x="100.236" y="11.333"/>
      <point x="123.682" y="13.6104" type="curve" smooth="yes"/>
      <point x="147.127" y="15.8867"/>
      <point x="188.734" y="20.209"/>
      <point x="207.592" y="122.035" type="curve" smooth="yes"/>
      <point x="226.45" y="223.861"/>
      <point x="211.432" y="248.599"/>
      <point x="211.432" y="248.599" type="curve"/>
      <point x="211.432" y="248.599"/>
      <point x="261.644" y="214.433"/>
      <point x="390.812" y="301.293" type="curve" smooth="yes"/>
    </contour>
  </outline>
</glyph>

image

for f in Untitled1.ufo/glyphs/*.glif; do Qstroke --path "$f" --out ${f/Untitled1/Untitled2} --pattern arrow.ufo/glyphs/arrow.glif -m repeated --sx 0.1 --sy 0.1 -s 2 ; done

forceclosed.zip

ctrlcctrlv commented 3 years ago

(Other issues can be seen in 22.glif, but the force close is the most obvious issue.)

MatthewBlanchard commented 3 years ago

Capture

Fixed in upcoming commit. The changes that need to be made to glifparser cause Qglif to generate a compiler panic?