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

[PaP] Another force closure bug when pattern isn't closed #22

Closed ctrlcctrlv closed 2 years ago

ctrlcctrlv commented 2 years ago

Although I'm sure it annoys the developers ( :) ), this is a valid pattern:

line.glif

<?xml version="1.0" encoding="UTF-8"?>
<glyph name="line" format="2">
  <advance width="104"/>
  <outline>
    <contour>
      <point x="0" y="13" type="move" name="T"/>
      <point x="54" y="13" type="line"/>
    </contour>
  </outline>
</glyph>

But trying to use it is force closing once again. I think the recent PaP upgrades broke this.

$ MFEKstroke PAP --pattern patterns.ufo/glyphs/line.glif --path FRBAmericanCursive-SOURCE.ufo/glyphs/i.glif --out /tmp/i.glif -s 4

image

<?xml version="1.0" encoding="UTF-8"?>
<glyph name="i" format="2">
  <advance width="441"/>
  <unicode hex="0069"/>
  <outline>
    <contour>
      <point x="400" y="414" type="curve" smooth="yes"/>
      <point x="400" y="424"/>
      <point x="408" y="432"/>
      <point x="418" y="432" type="curve" smooth="yes"/>
      <point x="428" y="432"/>
      <point x="436" y="424"/>
      <point x="436" y="414" type="curve" smooth="yes"/>
      <point x="436" y="404"/>
      <point x="428" y="396"/>
      <point x="418" y="396" type="curve" smooth="yes"/>
      <point x="408" y="396"/>
      <point x="400" y="404"/>
    </contour>
    <contour>
      <point x="0" y="0" type="move" smooth="yes"/>
      <point x="42.171" y="22.3844"/>
      <point x="223.994" y="112.874"/>
      <point x="325" y="255" type="curve"/>
      <point x="299.121" y="206.164"/>
      <point x="218.201" y="82"/>
      <point x="218.201" y="32.8374" type="curve" smooth="yes"/>
      <point x="218.201" y="18.0871"/>
      <point x="232.85" y="-7.76738"/>
      <point x="271.342" y="-7.76738" type="curve" smooth="yes"/>
      <point x="307.241" y="-7.76738"/>
      <point x="362.329" y="21.9137"/>
      <point x="441" y="77" type="curve"/>
    </contour>
  </outline>
</glyph>
ctrlcctrlv commented 2 years ago

Confirmed solved by https://github.com/MFEK/glifparser.rlib/commit/927a06f2d6ffc7a98e3393f49e266f0813457b41, thanks @MatthewBlanchard.