Re: Feature Request: Get envelope of path stroked with arbitrary pen
[email protected] Thu, 8 Feb 2018 18:36:59 -0600 (CST)
| Newsgroups | gmane.comp.tex.metapost |
|---|---|
| Message-ID | <[email protected]> |
On Thu, 8 Feb 2018, Kevin Keith wrote: > It would be of immense use if it were possible to get the path of the > outline of some arbitrary pen stroke. > Since metapost already outputs bezier curves, instead of bitmaps, it would > seem that the machinery to compute the envelope is already in place, so it > shouldn't be too difficult to expose this as an operator in the language > itself. I agree this would be nice. However, I don't think it's so easy to do. METATYPE1 (used by the Latin Modern project and my own Tsukurimashou) has an implementation in Metapost macros; it usually works, but requires handholding, and when it fails it's difficult to debug. FontForge also has an implementation of a similar feature, which has always been buggy and a cause of user complaints. If it were to be a Metapost language feature, I hope that the implementation would be at the standard of quality and non-bugginess that we expect of "engine" code in the TeX ecosystem - and I think algorithms to actually achieve that on the "expand stroke" problem may be an open research problem. Among other issues, the envelope of a path defined by cubic splines is not itself a cubic spline, so you need to do some approximation, and coming up with rules for how close the approximation needs to be, that cover all cases, is difficult. -- Matthew Skala [email protected] People before principles. http://ansuz.sooke.bc.ca/ -- http://tug.org/metapost/