[gsharp-devel] complexity of crotchet rest glyph

Christophe Rhodes csr21 at cantab.net
Wed Jul 11 21:38:37 UTC 2007


Hi,

The crotchet rest glyph in sdl.lisp looks appealing simple in its
source code.  Unfortunately, when converted into a bezier design, it
ends up being a complicated beast.

This became visible when I was looking at the output of my canvas
backend: the rapsoden-sjunger "screenshot" is of the order of 1MB, and
I believe that that's largely down to crotchet rests.  My minimal test
case is at <http://doc.gold.ac.uk/~mas01cr/tmp/crotchet-rest.html>
which (in <canvas>-enabled browsers) should show up as a single
crotchet rest on a treble staff -- what you get if you start gsharp up
and press the #\, key.

If you look at the source to that page, you will discover lots and
lots of javascript, being a faithful rendering of the bezier areas
making up that glyph.  There's nothing wrong with lots of javascript
if it's needed, and ultimately it's possible to treat gsharp designs
as client-side fonts or stored procedures, but the javascript emitted
reveals some actual uselessness: there are several exact repeats of
regions, such as those starting

ctx.moveTo(69.9044,82.5388); [x2]
ctx.moveTo(69.9044,93.9388); [x2]
ctx.moveTo(69.8245,93.8520); [x2]
ctx.moveTo(69.5153,93.5943); [x4]
ctx.moveTo(66.3841,94.9495); [x4]

and more besides.  (The quarter-rest glyph is a union of 47 bezier
areas -- no wonder good performance of the new bezier designs, in
mcclim CVS as of this evening, needed the optimization for translating
bezier unions...)

Finding some way of ensuring that these duplicate regions are not part
of the design would go some way to improving the performance of gsharp
in backends which draw bezier curves directly (rather than going
through pixmaps).  Any ideas on how to remove them?

Cheers,

Christophe



More information about the gsharp-devel mailing list