Hello Han-Wen,
> 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? Looking up the internet, I found these documents that might be of help to implement the handler otherwise: https://pomax.github.io/bezierinfo/ https://raphlinus.github.io/graphics/curves/2019/12/23/flatten-quadbez.html BTW, chances are good that Raph Levien's algorithm gets extended to third-order Beziers during a FreeType GSoC project this year :-) [*] Werner [*] I think he has already done the math but not coded it.
