text drawing artifact
Carl Worth
cworth at cworth.org
Thu May 30 19:57:06 UTC 2024
Hi Steven,
I got these images just fine through the list.
And thanks for your description of the problem.
That let me know what to look for and, yes, now that I knew what to look
for I could see the problem here.
If you remove the call and cairo_clip_preserve() from your code you
might see more plainly what's happening. With that, you'll see a line
drawn from the lower-right of the 'o' to the right-most point of your
circular button.
So what's happening here is that your cairo_show_text() call is leaving
the "current point" at the appropriate place for a subsequent glyph to
be drawn. Then, the first call of your unrelated drawing in the other
function, cairo_arc(), is adding additional elements onto the path. And
cairo_arc() is specified to add a connecting line segment from the
current point to the beginning of the arc:
* If there is a current point, an initial line segment will be added
* to the path to connect the current point to the beginning of the
* arc. If this initial line is undesired, it can be avoided by
* calling cairo_new_sub_path() before calling cairo_arc().
Here, you don't want that segment, so the solution is to do as said
above and call cairo_new_sub_path() immediately before the call to
cairo_arc().
That connecting line segment comes from the idea of using cairo_arc as
an element along a path, (imagine creating a rounded rectangle shape,
for example), but it's obviously not useful when you want a separate
circle.
And I suppose one could make an argument that maybe cairo_restore()
should be eliminating the current point? But that ship has already
sailed.
Anyway, sorry the API tripped you up here. But hopefully with that
simple addition of cairo_new_sub_path() you'll start getting the results
you want.
And have fun with cairo!
-Carl
On Wed, May 29 2024, Steven J. Abner wrote:
> On Wed, May 29 2024 at 09:56:14 PM +0000, Steven J Abner
> <pheonix.sja at att.net> wrote:
>> Here's png test
>> Steve
>
> x
> x
More information about the cairo
mailing list