[poppler] Clipping text in Splash before rendering it

Jeff Muizelaar jeff at infidigm.net
Sat Oct 13 16:28:25 PDT 2007


On Sun, Oct 14, 2007 at 01:17:05AM +0200, Albert Astals Cid wrote:
> Hi, this patch has two parts.
> 
> First, it removes all exit(1) calls in favor or the best i could find, that 
> is, return NULL (and hope the caller can understand NULL as error) in the 
> gmem routines and the correct ignore in DCTStream.

What's the motivation for this? Won't the callers just segfault
afterwards anyways? It looks like most callers assume that gammloc
succeeds. If we wanted to deal with the out of memory situation it would
require quite a bit of work to add all of the proper error handling
code. At least with exisiting implementation the application dies
cleanly instead of segfaulting. It would be nice to deal with
out-of-memory properly, but I think it would be quite a bit of work...

> 
> Second, in Splash code it moves the resposability for checking if a glyph is 
> inside the clip rect from Splash::fillGlyph2 to its callers, 
> Splash::fillGlyph and Splash::fillChar, that way i can check inside 
> SplashFTFont::makeGlyph if the font is inside the clip rect before rendering.
> 
> This fixes crash due to memory exhaustion on KDE bug 150693 [1] because that 
> pdf specifies a HUGE font outside the clip rect :-/

Didn't look at the splash stuff.

> 
> CairoOutputDev does not need to do that because cairo already does it.
> 
> If noone objects to the patch (that is a bit intrusive but clean enough imho) 
> i will commit it to HEAD and 0.6 branch next friday.

Regardless of whether this patch goes in or not, make sure you do it in
two commits because the changes are completely unrelated.

-Jeff


More information about the poppler mailing list