[cairo] Locking font / pen space

Andrea Canciani ranma42 at gmail.com
Mon Aug 30 09:41:26 PDT 2010


On Mon, Aug 30, 2010 at 6:01 PM, Behdad Esfahbod <behdad at behdad.org> wrote:
> On 08/27/10 16:37, Bill Spitzak wrote:
>>
>> I would prefer it to not be reset by changing the font/pen.
>
> Resetting is needed to preserve backward compatibility with old code.  Say, I
> have a library function foo_draw(cairo_t *cr).  foo_draw sets font, stroke,
> etc, then magnifies depending on a requested magnification level, and draws.
> This should not break, ever.  If the caller locks the font space and the lock
> doesn't release upon setting the font by foo_draw(), that function breaks.
You could say that the caller should _unlock before calling foo_draw().
This might be a good idea anyway, since the caller doesn't know if foo_draw
will reset it or not.
Andrea


More information about the cairo mailing list