static int pdf_document_get_n_pages (EvDocument *document);
static EvLink * ev_link_from_action (PopplerAction *action);
+static void pdf_document_search_free (PdfDocumentSearch *search);
G_DEFINE_TYPE_WITH_CODE (PdfDocument, pdf_document, G_TYPE_OBJECT,
0, 0,
width, height,
rc->scale,
- pixbuf,
- 0, 0);
+ pixbuf);
g_object_unref (poppler_page);
return result;
}
+static const char *
+font_type_to_string (PopplerFontType type)
+{
+ switch (type)
+ {
+ case POPPLER_FONT_TYPE_TYPE1:
+ return _("Type 1");
+ case POPPLER_FONT_TYPE_TYPE1C:
+ return _("Type 1C");
+ case POPPLER_FONT_TYPE_TYPE3:
+ return _("Type 3");
+ case POPPLER_FONT_TYPE_TRUETYPE:
+ return _("TrueType");
+ case POPPLER_FONT_TYPE_CID_TYPE0:
+ return _("Type 1 (CID)");
+ case POPPLER_FONT_TYPE_CID_TYPE0C:
+ return _("Type 1C (CID)");
+ case POPPLER_FONT_TYPE_CID_TYPE2:
+ return _("TrueType (CID)");
+ default:
+ return _("Unknown font type");
+ }
+}
+
static void
pdf_document_fonts_fill_model (EvDocumentFonts *document_fonts,
GtkTreeModel *model)
g_return_if_fail (PDF_IS_DOCUMENT (document_fonts));
- if (iter) {
- do {
- GtkTreeIter list_iter;
- const char *name;
+ if (!iter)
+ return;
+
+ do {
+ GtkTreeIter list_iter;
+ const char *name;
+ const char *type;
+ const char *embedded;
+ char *details;
- name = poppler_fonts_iter_get_name (iter);
- if (name == NULL) {
- name = _("No name");
- }
-
- gtk_list_store_append (GTK_LIST_STORE (model), &list_iter);
- gtk_list_store_set (GTK_LIST_STORE (model), &list_iter,
- EV_DOCUMENT_FONTS_COLUMN_NAME, name,
- -1);
- } while (poppler_fonts_iter_next (iter));
- }
+ name = poppler_fonts_iter_get_name (iter);
+
+ if (name == NULL) {
+ name = _("No name");
+ }
+
+ type = font_type_to_string (
+ poppler_fonts_iter_get_font_type (iter));
+
+ if (poppler_fonts_iter_is_embedded (iter)) {
+ if (poppler_fonts_iter_is_subset (iter))
+ embedded = _("Embedded subset");
+ else
+ embedded = _("Embedded");
+ } else {
+ embedded = _("Not embedded");
+ }
+
+ details = g_markup_printf_escaped ("%s\n%s", type, embedded);
+
+ gtk_list_store_append (GTK_LIST_STORE (model), &list_iter);
+ gtk_list_store_set (GTK_LIST_STORE (model), &list_iter,
+ EV_DOCUMENT_FONTS_COLUMN_NAME, name,
+ EV_DOCUMENT_FONTS_COLUMN_DETAILS, details,
+ -1);
+
+ g_free (details);
+ } while (poppler_fonts_iter_next (iter));
}
static void
gboolean border)
{
PopplerPage *poppler_page;
- GdkPixbuf *pixbuf;
+ GdkPixbuf *pixbuf, *sub_pixbuf;
int width, height;
- int x_offset, y_offset;
double scale;
gdouble unscaled_width, unscaled_height;
if (border) {
pixbuf = ev_document_misc_get_thumbnail_frame (width, height, NULL);
- x_offset = 1;
- y_offset = 1;
+
+ sub_pixbuf = gdk_pixbuf_new_subpixbuf (pixbuf,
+ 1, 1,
+ width - 1, height - 1);
} else {
pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, TRUE, 8,
width, height);
gdk_pixbuf_fill (pixbuf, 0xffffffff);
- x_offset = 0;
- y_offset = 0;
+ sub_pixbuf = gdk_pixbuf_new_subpixbuf (pixbuf,
+ 0, 0,
+ width, height);
}
poppler_page_render_to_pixbuf (poppler_page, 0, 0,
width, height,
- scale, pixbuf,
- x_offset, y_offset);
+ scale, sub_pixbuf);
+
+ g_object_unref (G_OBJECT (sub_pixbuf));
g_object_unref (poppler_page);
return pixbuf;
return retval;
}
+GdkRegion *
+pdf_selection_get_selection_map (EvSelection *selection,
+ EvRenderContext *rc)
+{
+ PdfDocument *pdf_document;
+ PopplerPage *poppler_page;
+ PopplerRectangle points;
+ GdkRegion *retval;
+
+ pdf_document = PDF_DOCUMENT (selection);
+ poppler_page = poppler_document_get_page (pdf_document->document,
+ rc->page);
+ set_page_orientation (pdf_document, poppler_page);
+
+ points.x1 = 0.0;
+ points.y1 = 0.0;
+ poppler_page_get_size (poppler_page, &(points.x2), &(points.y2));
+ retval = poppler_page_get_selection_region (poppler_page, 1.0, &points);
+ g_object_unref (poppler_page);
+
+ return retval;
+}
+
static void
pdf_selection_iface_init (EvSelectionIface *iface)
{
iface->render_selection = pdf_selection_render_selection;
iface->get_selection_region = pdf_selection_get_selection_region;
+ iface->get_selection_map = pdf_selection_get_selection_map;
}
PdfDocument *