]> git.donarmstrong.com Git - lilypond.git/commit
Issue 2658: Be serious about setstrokeadjust in PostScript primitives
authorDavid Kastrup <dak@gnu.org>
Thu, 11 Apr 2013 15:27:14 +0000 (17:27 +0200)
committerDavid Kastrup <dak@gnu.org>
Sat, 7 Dec 2013 11:48:17 +0000 (12:48 +0100)
commit6bf9a5a3dbcabff297d5bcdb3cf1dffd0885cbbc
tree54a6ab0e70fc36521bffe0b0d3c6409c52436491
parent7d236e22cf4737ddea1d888dc68a50ae26a64043
Issue 2658: Be serious about setstrokeadjust in PostScript primitives

This particularly concerns draw_round_box which is used for drawing
lines with a rounded ending.  If the width/height ratio or its inverse
exceeds 2, the box is considered to be a "line".  In this case, first
a clipping path is established representing the whole shape and
extended widely in the area of the "main stroke".  The reason for this
extension is to avoid both clip area and stroke competing for the
outline.  While this is not a problem for the PostScript or PDF
rendering model, the Cairo bitmap rendering library employs
Porter-Duff compositing for antialiasing amounting to "cheap man's
antialiasing" not requiring a higher rendering resolution but relying
on edges affecting a single pixel to be independent.

Porter-Duff requires us not to have multiple parallel strokes or clip
areas if we want to avoid wrong sub-pixel grayness levels (and
consequently lines appearing too thick or thin) in Cairo-based
previewers like Evince.

After establishing the clip area, a stroke is drawn through.  This
stroke may (at the PostScript device's discretion) employ
strokeadjustment further correcting the apparent thickness.
Ghostscript employs stroke adjustment when rendering at a resolution
below 150dpi.  Stroke adjustment does not pass into PDF, however, when
ps2pdf runs.

Ghostscript performs sub-pixel rendering for antialiasing which
reduces the amount of discontinuities possibly caused by joining
stroke-adjusted shapes with full shapes.

It turns out that sharper contours can be achieved by using strokepath
and fill instead of a plain stroke.  However, the resulting crisper
stems tend to combine worse with beams, so this approach has not been
pursued.
ps/music-drawing-routines.ps