* Source/cairo/CairoGState.m (-DPSstroke:): If the line width is

0, temporarily set it to 1 unit wide (in device space.) This
is an attempt at matching the behaviour of the setlinewidth
PostScript operator, which is supposed to interpret 0 as meaning
the thinnest line that the output device can draw.
Note that Quartz (and cairo) draw nothing with a line width of 0.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/back/trunk@33739 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
ericwa 2011-08-15 19:23:49 +00:00
parent e65aa1f9f9
commit c048f8882f
2 changed files with 28 additions and 0 deletions

View file

@ -1,3 +1,12 @@
2011-08-15 Eric Wasylishen <ewasylishen@gmail.com>
* Source/cairo/CairoGState.m (-DPSstroke:): If the line width is
0, temporarily set it to 1 unit wide (in device space.) This
is an attempt at matching the behaviour of the setlinewidth
PostScript operator, which is supposed to interpret 0 as meaning
the thinnest line that the output device can draw.
Note that Quartz (and cairo) draw nothing with a line width of 0.
2011-08-07 Eric Wasylishen <ewasylishen@gmail.com>
* Tools/xpbs.m: Add some more comments

View file

@ -779,6 +779,7 @@ static float floatToUserSpace(NSAffineTransform *ctm, float f)
{
if (_ct)
{
BOOL zeroLineWidth = NO;
device_color_t c;
c = strokeColor;
@ -786,7 +787,25 @@ static float floatToUserSpace(NSAffineTransform *ctm, float f)
// The underlying concept does not allow to determine if alpha is set or not.
cairo_set_source_rgba(_ct, c.field[0], c.field[1], c.field[2], c.field[AINDEX]);
[self _setPath];
// If the line width is 0, draw a thin line.
// cairo (and Quartz) will draw nothing with a line width of 0.
// See the PostScript Language Reference, 3rd ed, p. 674
if (cairo_get_line_width(_ct) == 0)
{
double w1 = 1.0;
double w2 = 1.0;
cairo_device_to_user_distance(_ct, &w1, &w2);
cairo_set_line_width(_ct, w1);
zeroLineWidth = YES;
}
cairo_stroke(_ct);
if (zeroLineWidth)
{
cairo_set_line_width(_ct, 0);
}
}
[self DPSnewpath];
}