[poppler] 3 commits - glib/demo glib/poppler-document.cc glib/poppler-document.h glib/reference

Adrian Johnson ajohnson at kemper.freedesktop.org
Thu Mar 1 02:54:25 PST 2012


 glib/demo/fonts.c                   |    6 ++++--
 glib/demo/selections.c              |   20 ++++++++++++++++++++
 glib/poppler-document.cc            |   27 +++++++++++++++++++++++++++
 glib/poppler-document.h             |    1 +
 glib/reference/poppler-docs.sgml    |    4 ++++
 glib/reference/poppler-sections.txt |    1 +
 6 files changed, 57 insertions(+), 2 deletions(-)

New commits:
commit a2b008223ad6887f00d76c535f2b0b0f13f52b76
Author: Adrian Johnson <ajohnson at redneon.com>
Date:   Tue Feb 28 21:38:19 2012 +1030

    glib: add copy button to selections demo

diff --git a/glib/demo/selections.c b/glib/demo/selections.c
index 881733e..3912dc6 100644
--- a/glib/demo/selections.c
+++ b/glib/demo/selections.c
@@ -34,6 +34,7 @@ typedef struct {
 	GtkWidget            *darea;
 	GtkWidget            *fg_color_button;
 	GtkWidget            *bg_color_button;
+	GtkWidget            *copy_button;
 
 	PopplerPage          *page;
 	cairo_surface_t      *surface;
@@ -76,6 +77,7 @@ pgd_selections_clear_selections (PgdSelectionsDemo *demo)
 		cairo_region_destroy (demo->selected_region);
 		demo->selected_region = NULL;
 	}
+	gtk_widget_set_sensitive(demo->copy_button, FALSE);
 }
 
 static void
@@ -146,6 +148,7 @@ pgd_selections_update_seleted_text (PgdSelectionsDemo *demo)
 	if (text) {
 		demo->selected_text = g_utf8_normalize (text, -1, G_NORMALIZE_NFKC);
 		g_free (text);
+		gtk_widget_set_sensitive(demo->copy_button, TRUE);
 	}
 }
 
@@ -430,6 +433,15 @@ pgd_selections_render (GtkButton         *button,
 }
 
 static void
+pgd_selections_copy (GtkButton         *button,
+		     PgdSelectionsDemo *demo)
+{
+	GtkClipboard *clipboard = gtk_clipboard_get_for_display(gdk_display_get_default(),
+								GDK_SELECTION_CLIPBOARD);
+	gtk_clipboard_set_text (clipboard, demo->selected_text, -1);
+}
+
+static void
 pgd_selections_page_selector_value_changed (GtkSpinButton     *spinbutton,
 					    PgdSelectionsDemo *demo)
 {
@@ -599,6 +611,14 @@ pgd_selections_properties_selector_create (PgdSelectionsDemo *demo)
 	gtk_box_pack_start (GTK_BOX (hbox), color_hbox, FALSE, TRUE, 0);
 	gtk_widget_show (color_hbox);
 
+	demo->copy_button = gtk_button_new_with_label ("Copy");
+	g_signal_connect (G_OBJECT (demo->copy_button), "clicked",
+			  G_CALLBACK (pgd_selections_copy),
+			  (gpointer)demo);
+	gtk_box_pack_end (GTK_BOX (hbox), demo->copy_button, FALSE, TRUE, 0);
+	gtk_widget_set_sensitive(demo->copy_button, FALSE);
+	gtk_widget_show (demo->copy_button);
+
 	button = gtk_button_new_with_label ("Render");
 	g_signal_connect (G_OBJECT (button), "clicked",
 			  G_CALLBACK (pgd_selections_render),
commit b666d19308a043206e405c7e9d4ad709d68d331b
Author: Adrian Johnson <ajohnson at redneon.com>
Date:   Tue Feb 28 21:07:06 2012 +1030

    glib: show substitute font name in demo

diff --git a/glib/demo/fonts.c b/glib/demo/fonts.c
index 07ea589..bbc9b8a 100644
--- a/glib/demo/fonts.c
+++ b/glib/demo/fonts.c
@@ -155,6 +155,7 @@ pgd_fonts_fill_model (PgdFontsDemo *demo)
 			const gchar *name;
 			const gchar *type;
 			const gchar *embedded;
+			const gchar *substitute;
 			const gchar *filename;
 			gchar       *details;
 
@@ -173,10 +174,11 @@ pgd_fonts_fill_model (PgdFontsDemo *demo)
 				embedded = "Not embedded";
 			}
 
+			substitute = poppler_fonts_iter_get_substitute_name (fonts_iter);
 			filename = poppler_fonts_iter_get_file_name (fonts_iter);
 
-			if (filename)
-				details = g_markup_printf_escaped ("%s\n%s (%s)", type, embedded, filename);
+			if (substitute && filename)
+				details = g_markup_printf_escaped ("%s\n%s, substituting with <b>%s</b>\n(%s)", type, embedded, substitute, filename);
 			else
 				details = g_markup_printf_escaped ("%s\n%s", type, embedded);
 
commit 18bc59fcf5a59b1fd51a631c02e900790c3a6dc0
Author: Adrian Johnson <ajohnson at redneon.com>
Date:   Tue Feb 28 21:06:38 2012 +1030

    glib: add poppler_fonts_iter_get_substitute_name

diff --git a/glib/poppler-document.cc b/glib/poppler-document.cc
index bf83bf0..59124b5 100644
--- a/glib/poppler-document.cc
+++ b/glib/poppler-document.cc
@@ -1716,6 +1716,33 @@ poppler_fonts_iter_get_name (PopplerFontsIter *iter)
 }
 
 /**
+ * poppler_fonts_iter_get_substitute_name:
+ * @iter: a #PopplerFontsIter
+ *
+ * The name of the substitute font of the font associated with @iter or %NULL if
+ * the font is embedded
+ *
+ * Returns: the name of the substitute font or %NULL y font is emebedded
+ *
+ * Since: 0.20
+ */
+const char *
+poppler_fonts_iter_get_substitute_name (PopplerFontsIter *iter)
+{
+	GooString *name;
+	FontInfo *info;
+
+	info = (FontInfo *)iter->items->get (iter->index);
+
+	name = info->getSubstituteName();
+	if (name != NULL) {
+		return name->getCString();
+	} else {
+		return NULL;
+	}
+}
+
+/**
  * poppler_fonts_iter_get_file_name:
  * @iter: a #PopplerFontsIter
  *
diff --git a/glib/poppler-document.h b/glib/poppler-document.h
index 4ab17c8..d29ef6b 100644
--- a/glib/poppler-document.h
+++ b/glib/poppler-document.h
@@ -246,6 +246,7 @@ PopplerFontsIter *poppler_fonts_iter_copy          (PopplerFontsIter  *iter);
 void              poppler_fonts_iter_free          (PopplerFontsIter  *iter);
 const char       *poppler_fonts_iter_get_name      (PopplerFontsIter  *iter);
 const char       *poppler_fonts_iter_get_full_name (PopplerFontsIter  *iter);
+const char       *poppler_fonts_iter_get_substitute_name (PopplerFontsIter *iter);
 const char       *poppler_fonts_iter_get_file_name (PopplerFontsIter  *iter);
 PopplerFontType   poppler_fonts_iter_get_font_type (PopplerFontsIter  *iter);
 gboolean	  poppler_fonts_iter_is_embedded   (PopplerFontsIter  *iter);
diff --git a/glib/reference/poppler-docs.sgml b/glib/reference/poppler-docs.sgml
index 390ae67..d15bd18 100644
--- a/glib/reference/poppler-docs.sgml
+++ b/glib/reference/poppler-docs.sgml
@@ -50,6 +50,10 @@
     <title>Index of new symbols in 0.18</title>
     <xi:include href="xml/api-index-0.18.xml"><xi:fallback /></xi:include>
   </index>
+  <index id="api-index-0-20">
+    <title>Index of new symbols in 0.20</title>
+    <xi:include href="xml/api-index-0.20.xml"><xi:fallback /></xi:include>
+  </index>
 
   <xi:include href="xml/annotation-glossary.xml"><xi:fallback /></xi:include>
 </book>
diff --git a/glib/reference/poppler-sections.txt b/glib/reference/poppler-sections.txt
index c2759b8..08df585 100644
--- a/glib/reference/poppler-sections.txt
+++ b/glib/reference/poppler-sections.txt
@@ -156,6 +156,7 @@ poppler_fonts_iter_free
 poppler_fonts_iter_get_name
 poppler_fonts_iter_get_full_name
 poppler_fonts_iter_get_font_type
+poppler_fonts_iter_get_substitute_name
 poppler_fonts_iter_get_file_name
 poppler_fonts_iter_is_embedded
 poppler_fonts_iter_is_subset


More information about the poppler mailing list