On Fri, Apr 24, 2020 at 5:54 PM Han-Wen Nienhuys <[email protected]> wrote: > > On Fri, Apr 17, 2020 at 7:56 PM Werner LEMBERG <[email protected]> wrote: > > > I've been looking into performance, and one big source of slowness > > > is calculating skylines. I found that we calculate exact skylines > > > based on glyph shapes for some symbols. > > > > > > For example, for the F clef, we compute an outline of 23 and 20 > > > segments, based on sampling the exact bezier curves in the glyph. > > > This is silly (because the F clef is obscured by the staff symbol), > > > but even if it weren't, it seems extremely expensive overkill. Can > > > you recommend a mechanism by which we can get a linear approximation > > > of the curve directly out of freetype? > > > > FreeType doesn't offer this, sorry – at least not in a form that would > > be usable for LilyPond IMHO. You could use `FT_Outline_Decompose` and > > register your own handler for simplifying Bezier arcs – given the > > well-behaving of font outlines (at least in Feta), maybe the direct > > use of control points are sufficient, possibly doing one or at most > > two de Casteljau subdivisions? > > Good idea. I'll keep it in mind. Other question: is there a standard > wrt to outline direction? If I can assume that external outlines go in > clockwise order, I could skip left-pointing path elements when > creating the upwards skyline, cutting the amount of work in half. > Also, is there is way to detect internal curves (eg. the inner curve > of the O glyph?).
In https://docs.microsoft.com/en-us/typography/opentype/spec/ttch01 it is explained that outside curves go clockwise. Does that hold for other font types too? (PFA, OTF?) -- Han-Wen Nienhuys - [email protected] - http://www.xs4all.nl/~hanwen
