[cairo] Locking font / pen space
spitzak at gmail.com
Mon Aug 30 10:44:15 PDT 2010
Behdad Esfahbod 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.
> Preserving backward compatibility was the whole point of proposing this API.
I think it is acceptable to require any caller that sets this mode to
reset it before calling a function if that function is relying on the
mode being off. You could use the same rules to say that a caller should
not be able to destroy a surface, since they should not use that call
before passing the surface to a function that wants to use it.
I do not like having to call the lock after every font selection, as it
is obviously incompatible and different from the pattern space. It is
also annoyingly wasteful, as otherwise when this mode is on the back end
can go straight to device space without having to store any intermediate
information and wait for the call.
More information about the cairo