Hi Tom,

> > It seems that when we cache the cairo_font_face_t in CairoGraphics2D
> > (well, the native peer), we lose the transform that was originally
> > applied to it.  In the patch, I've simply removed this caching
> > behaviour, and the jfig tests work.  Of course, that results in reduced
> > performance and isn't the ideal solution.
> 
> Can you quantify the reduction in performance?  If it's not major, then I 
> think 
> this patch should go in and we can try different optimization strategies 
> later.

I haven't done anything quantitative, but without caching we would be
creating and disposing a new cairo_font_face_t on each and every
drawGlyphVector call.

Now that I look at it again, I wonder why we can't just create the
cairo_font_face_t when we setFont(), and keep it around until the font
is changed.  I'll give that a try first... if it doesn't work, I'll try
to quantify the performance of this patch and commit if it's not too
bad.

> > I tried playing around with cairo_get/set_font_matrix as well, caching
> > and restoring it, but that didn't seem to have any effect; I'm not sure
> > what else could be reset and lost in the caching process which would
> > affect the transform...
> 
> Have you tried debugging cairo itself to see how it manages the transforms 
> that 
> CairoGraphics2D passes to it?

No, I didn't look that far... I wasn't too sure whether this was
relevant, since we never use cairo_get/set_font_matrix anywhere else in
our code, so I gave up after a quick test.

Francis



Reply via email to