[poppler] New selection code

Kristian Høgsberg krh at bitplanet.net
Wed Jun 29 14:46:11 PDT 2005


Hi,

I've just committed support for "real" text selection in poppler.  The 
old rectangular selection mode was kinda weird, and not really useful. 
The new stuff is just regular selection, as seen in basically every 
other application.  Jonathan has been working on integrating it into 
evince, here's a couple of screenshots:

	http://freedesktop.org/~krh/evince-selection.png
	http://jrb.webwynk.net/Screenshot-pandp12p.pdf.png

The API exposed in the glib wrapper is pretty simple:

	void
	poppler_page_render_selection (PopplerPage *page,
         	                       gdouble      scale,
                 	               GdkPixbuf   *pixbuf,
                         	       PopplerRectangle *selection,
	                               PopplerRectangle *old_selection);

	GdkRegion *
	poppler_page_get_selection_region (PopplerPage      *page,
         	                           gdouble           scale,
                 	                   PopplerRectangle *selection);

but most of the functionality is implemented in TextOutputDev.cc.  The 
selection drawing code should work with the splash backend and the 
Arthur backend, since it's using the OutputDev class for rendering.  One 
requirement is that the OutputDev implementation use drawChar for 
rendering text and not drawString.

I expect to spend some time optimizing, tweaking and fixing the code, 
but it is basically usable at this point, and once we get the evince 
part to a committable state, it should be easy to check this stuff out 
and play with it.

cheers,
Kristian


More information about the poppler mailing list