[cairo] Stroke adjust for filled rectangles?

David Kastrup dak at gnu.org
Fri Jul 24 01:06:08 PDT 2015


I encountered the problem in the past that note stems in LilyPond render
rather inconsistently and generally too thick in PDF viewers using Cairo.

Now the stems are rounded rectangles, and they are unsurprisingly done
by stroking a closed rectangle with a circular pen (or rather with a
given line thickness and rounded corners) and then filling the path.

Now what happens is that the stroke adjustment for the left and right
edges of the note stem is applied independently, based on the visual
thickness of the outline rather than of the resulting filled shape.
Which causes more rather than less jitter on the overall thickness of
the stem.  Also the antialiasing considers left stroke, right stroke,
and filling as independent applications of ink, resulting in too much
ink applied when the scale of the stem would make it cover a breadth of
2 pixels or less.

So the basic question is whether it would be possible to detect the case
of slender and/or filled rectangular shapes to a sufficient degree to
make their edges and innards render like one coherent entity rather than
five independent ones (4 edges and one inner rectangle).

David Kastrup

More information about the cairo mailing list