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

Move nib stroker to `MFEK/math.rlib` #15

Open ctrlcctrlv opened 3 years ago

ctrlcctrlv commented 3 years ago

@MatthewBlanchard had a good idea: supporting nib stroking in MFEKglif.

But, that can't happen without some changes, because MFEKstroke is a top-level module. It can't be included in MFEKglif.

src/nib_stroke/fontforge.rs needs to be moved to MFEK/math.rlib. The conditional compilation option will stay, but it will just decide whether or not MFEK/math.rlib should pull in FontForge (libfontforge.so / libfontforge.dll) via a feature tag.

The API also needs to change...

This function right now assumes a CLI API:

https://github.com/MFEK/stroke/blob/6c9db1bde4c0875ec22747c8ec67312d87db510a/src/nib_stroke/fontforge.rs#L250

So, it returns us back an Option<String> representing .glif data. Which we then write if it's of variant Some(glifxml). It should actually return a Result<Glif, NibStrokeError>. That would make MFEKstroke responsible for calling glifparser::write.

This way, it can be used from MFEKglif and MFEKstroke, just like CWS and PAP.

This is my fault, so I ought to be the one to fix it. Let's say it was a failure of imagination on my part to not think that this would be callable from MFEKglif. What was I thinking? :-)