## Re: [PyX-devel] Re: GlyphInterchangeFormat

 Re: [PyX-devel] Re: GlyphInterchangeFormat From: Michael Schindler - 2004-08-03 12:47:36 ```Hi, As far as I know this is what people use: 1. For the interpolation problem: Curves passing through given points: (A) smooth curves built by piecewise polynoms (parameterized by the spacial coordinates). This requires to solve quite large systems of linear equations -- not a problem in principle, but the outcome is often poor because the polynoms are too restrictive. > IIRC Michael Schindler played with some smooth curve thru some given > points before already. I'm not sure whether any code is laying around > somewhere, which could be usefull in that respect. But in principle > you're right: it might be added on top of the existing PyX. for the case of equal spacing this problem needs no numeric solver, and I am planning to implement this as a graph.style.curve (B) parametric curves. In principle one gets non-linear equations for the parameter values -- a really hard problem. This requires a lot of information on the specific geometric case. Especially, using boundary constraints like a certain tangent of a curve or so is not straight-forward formulated in terms of a general parameterization. This is maybe what Magnus Lie Hetland asks for. > > The curve construction reminds me of a feature (or set of features) > > from MetaPost that I believe is not available in PyX, but which can be > > quite nice... Basically, it's the spline stuff that tries to fit a > > curve to the points you give (without you having to give the Bezier > > contour points explicitly). Also, you can give such (very useful) > > constraints as the direction of the curve at a given point, and the > > spline will adapt to that. I assume this could quite easily be built > > on *top* of PyX -- I just thought it might be nice to have it as an > > integrated part of the path mechanism? (I don't know the details of > > the splines used by MP/MF, but they look fine, IMO.) I do not know how metafont is doing that, but I think MF knows some generic cases and uses a kind of "optimal" parameterization -- depending on the problem it has to solve. I do not even think that it is really an interpolating program -- rather a mixture of interpolating and optimisation... Another example is finding the outline of brushes or enlarging arbitrarily shaped boxes. > > And another thing... I have no idea how it's done in MP (in MF I can > > sort of understand it) but MP allows you to use custom-made paths as > > brushes in other parhts. Very nice for calligraphic-like looks, for > > example. (I guess one heavy-handed way of doing it would be simply to > > replicate the brush all along the path, with the appropriate spacing > > calcilated somehow, perhaps even dynamically along the path.) 2. Optimization problem: Approximating curves (C) Mainly used are extended bezier curves that have a well-specified starting and ending point and try to pass through several other points on their way. To me this never looked very useful ... Maybe there is the "quadrature of the circle": The bezier curves depend linearly on their endpoints. For them one can build up a linear system of equations -- again with some (linear) constraints ... This would merge the advantages of the (ordinary) splines and the parametric curves ... Does anyone know the name of this method or where to find this? I would say that this might be the most promising way to build a general algorithm in PyX for these non-standard path operations. Michael. -- "A mathematician is a device for turning coffee into theorems" Paul Erdös. ```

 [PyX-devel] Re: GlyphInterchangeFormat From: Andre Wobst - 2004-08-03 08:39:01 ```Hi, I just got some interesting links from a friend: On 03.08.04, Rolf Niepraschk wrote: > The GlyphInterchangeFormat (or GLIF) is a simple and clear XML > representation of a single glyph. It is a major part of the RoboFab > project, and it is the foundation of the UnifiedFontObject. GLIF files > usually have a ".glif" extension. > > ==> http://just.letterror.com/ltrwiki/GlyphInterchangeFormat > > RoboFab is a library of python code for manipulation and storage of font > and glyph related data. RoboFab implements a new font file format, the > UnifiedFontObject(s) or .ufo for short. > > ==> http://just.letterror.com/ltrwiki/RoboFab > > The UnifiedFontObject (or UFO) is a two headed beast. It is both a file > format (see specification below) and a python scripting interface (see > short description below) for dealing with font related data. Here's some > general info: http://www.letterror.com/code/robofab/ufo.html > > ==> http://just.letterror.com/ltrwiki/UnifiedFontObject > > > ...Rolf > -- > || Rolf Niepraschk c/o Physikalisch-Technische Bundesanstalt || > || Abbestr. 2-12; D-10587 Berlin, Germany || > || Tel/Fax: ++49-30-3481-316/490, email: Rolf.Niepraschk@... || André -- by _ _ _ Dr. André Wobst / \ \ / ) wobsta@..., http://www.wobsta.de/ / _ \ \/\/ / PyX - High quality PostScript figures with Python & TeX (_/ \_)_/\_/ visit http://pyx.sourceforge.net/ ```
 Re: [PyX-devel] Re: GlyphInterchangeFormat From: Magnus Lie Hetland - 2004-08-03 10:50:43 ```Andre Wobst : > > Hi, > > I just got some interesting links from a friend: That is indeed rather interesting. The curve construction reminds me of a feature (or set of features) from MetaPost that I believe is not available in PyX, but which can be quite nice... Basically, it's the spline stuff that tries to fit a curve to the points you give (without you having to give the Bezier contour points explicitly). Also, you can give such (very useful) constraints as the direction of the curve at a given point, and the spline will adapt to that. I assume this could quite easily be built on *top* of PyX -- I just thought it might be nice to have it as an integrated part of the path mechanism? (I don't know the details of the splines used by MP/MF, but they look fine, IMO.) And another thing... I have no idea how it's done in MP (in MF I can sort of understand it) but MP allows you to use custom-made paths as brushes in other parhts. Very nice for calligraphic-like looks, for example. (I guess one heavy-handed way of doing it would be simply to replicate the brush all along the path, with the appropriate spacing calcilated somehow, perhaps even dynamically along the path.) Sorry to turn yet another thread into one about possible features... These are just a couple of things that came up when I took a stab at implementing big, flexible braces (such as these: http://just.letterror.com/ltrwiki/GlyphInterchangeFormat) in PyX. -- Magnus Lie Hetland "Canned Bread: The greatest thing since sliced http://hetland.org bread!" [from a can in Spongebob Squarepants] ```
 Re: [PyX-devel] Re: GlyphInterchangeFormat From: Andre Wobst - 2004-08-03 11:29:52 ```Hi, On 03.08.04, Magnus Lie Hetland wrote: > The curve construction reminds me of a feature (or set of features) > from MetaPost that I believe is not available in PyX, but which can be > quite nice... Basically, it's the spline stuff that tries to fit a > curve to the points you give (without you having to give the Bezier > contour points explicitly). Also, you can give such (very useful) > constraints as the direction of the curve at a given point, and the > spline will adapt to that. I assume this could quite easily be built > on *top* of PyX -- I just thought it might be nice to have it as an > integrated part of the path mechanism? (I don't know the details of > the splines used by MP/MF, but they look fine, IMO.) IIRC Michael Schindler played with some smooth curve thru some given points before already. I'm not sure whether any code is laying around somewhere, which could be usefull in that respect. But in principle you're right: it might be added on top of the existing PyX. > And another thing... I have no idea how it's done in MP (in MF I can > sort of understand it) but MP allows you to use custom-made paths as > brushes in other parhts. Very nice for calligraphic-like looks, for > example. (I guess one heavy-handed way of doing it would be simply to > replicate the brush all along the path, with the appropriate spacing > calcilated somehow, perhaps even dynamically along the path.) You're talking about pens, not fill patterns, right? I looked at this topic a few months ago after somebody asked me about it. In MetaPost you can do two kind of pen shapes: a polygon pen shape and a elliptic pen shape. For the first MetaPost calculates the boundary of the area to be stroked (i.e. filled, once the outline is calculated). While this is already a interesting part to program, the elliptic curve is quite different. MetaPost does not calculate a outline for that case (it would be an interesting challange, which seems to be related to the enlargment of arbitrary shaped boxes as we started to experiment in one of the test/experimental files some time ago). What metapost does is to draw the path with a circular pen (i.e. that's what PostScript does for a finite linewidth and round setting of linecap and linejoin). However, this drawing does not happen on the original path, but on a transformed path, where the transformation is the one to make the elliptic pen circular. To finally get the correct result, the transformation from the circular pen to the elliptic one is applied to the stroked path. That way you can stroke the path with a elliptic pen, but you can't calculated the outline. (AFAIK that's one of the problems people have to create outline fonts out of Metafont fonts.) > Sorry to turn yet another thread into one about possible features... > These are just a couple of things that came up when I took a stab at > implementing big, flexible braces (such as these: > http://just.letterror.com/ltrwiki/GlyphInterchangeFormat) in PyX. No problem. It's always interesting to look around ... André -- by _ _ _ Dr. André Wobst / \ \ / ) wobsta@..., http://www.wobsta.de/ / _ \ \/\/ / PyX - High quality PostScript figures with Python & TeX (_/ \_)_/\_/ visit http://pyx.sourceforge.net/ ```
 Re: [PyX-devel] Re: GlyphInterchangeFormat From: Michael Schindler - 2004-08-03 12:47:36 ```Hi, As far as I know this is what people use: 1. For the interpolation problem: Curves passing through given points: (A) smooth curves built by piecewise polynoms (parameterized by the spacial coordinates). This requires to solve quite large systems of linear equations -- not a problem in principle, but the outcome is often poor because the polynoms are too restrictive. > IIRC Michael Schindler played with some smooth curve thru some given > points before already. I'm not sure whether any code is laying around > somewhere, which could be usefull in that respect. But in principle > you're right: it might be added on top of the existing PyX. for the case of equal spacing this problem needs no numeric solver, and I am planning to implement this as a graph.style.curve (B) parametric curves. In principle one gets non-linear equations for the parameter values -- a really hard problem. This requires a lot of information on the specific geometric case. Especially, using boundary constraints like a certain tangent of a curve or so is not straight-forward formulated in terms of a general parameterization. This is maybe what Magnus Lie Hetland asks for. > > The curve construction reminds me of a feature (or set of features) > > from MetaPost that I believe is not available in PyX, but which can be > > quite nice... Basically, it's the spline stuff that tries to fit a > > curve to the points you give (without you having to give the Bezier > > contour points explicitly). Also, you can give such (very useful) > > constraints as the direction of the curve at a given point, and the > > spline will adapt to that. I assume this could quite easily be built > > on *top* of PyX -- I just thought it might be nice to have it as an > > integrated part of the path mechanism? (I don't know the details of > > the splines used by MP/MF, but they look fine, IMO.) I do not know how metafont is doing that, but I think MF knows some generic cases and uses a kind of "optimal" parameterization -- depending on the problem it has to solve. I do not even think that it is really an interpolating program -- rather a mixture of interpolating and optimisation... Another example is finding the outline of brushes or enlarging arbitrarily shaped boxes. > > And another thing... I have no idea how it's done in MP (in MF I can > > sort of understand it) but MP allows you to use custom-made paths as > > brushes in other parhts. Very nice for calligraphic-like looks, for > > example. (I guess one heavy-handed way of doing it would be simply to > > replicate the brush all along the path, with the appropriate spacing > > calcilated somehow, perhaps even dynamically along the path.) 2. Optimization problem: Approximating curves (C) Mainly used are extended bezier curves that have a well-specified starting and ending point and try to pass through several other points on their way. To me this never looked very useful ... Maybe there is the "quadrature of the circle": The bezier curves depend linearly on their endpoints. For them one can build up a linear system of equations -- again with some (linear) constraints ... This would merge the advantages of the (ordinary) splines and the parametric curves ... Does anyone know the name of this method or where to find this? I would say that this might be the most promising way to build a general algorithm in PyX for these non-standard path operations. Michael. -- "A mathematician is a device for turning coffee into theorems" Paul Erdös. ```