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

Adrian Johnson ajohnson at kemper.freedesktop.org
Wed Mar 7 03:06:22 PST 2012


 glib/demo/fonts.c                   |    9 +++++++--
 glib/demo/main.c                    |    9 +++++++++
 glib/poppler-document.cc            |   26 ++++++++++++++++++++++++++
 glib/poppler-document.h             |    1 +
 glib/reference/poppler-sections.txt |    1 +
 5 files changed, 44 insertions(+), 2 deletions(-)

New commits:
commit 68625258ab3cfc3e8e10a727e397f80bed0d1f5c
Author: Adrian Johnson <ajohnson at redneon.com>
Date:   Sun Mar 4 18:37:53 2012 +1030

    glib demo: make ctrl-q quit the demo

diff --git a/glib/demo/main.c b/glib/demo/main.c
index 9e11577..f52c5b8 100644
--- a/glib/demo/main.c
+++ b/glib/demo/main.c
@@ -296,6 +296,8 @@ gint main (gint argc, gchar **argv)
 	gchar            *uri;
 	GTimer           *timer;
 	GError           *error = NULL;
+	GtkAccelGroup    *gtk_accel;
+	GClosure         *closure;
 
 	if (argc != 2) {
 		g_print ("Usage: poppler-glib-demo FILE\n");
@@ -364,6 +366,13 @@ gint main (gint argc, gchar **argv)
 	g_signal_connect (G_OBJECT (win), "delete-event",
 			  G_CALLBACK (gtk_main_quit), NULL);
 
+	gtk_accel = gtk_accel_group_new ();
+	closure = g_cclosure_new (G_CALLBACK (gtk_main_quit), NULL, NULL);
+	gtk_accel_group_connect (gtk_accel, gdk_keyval_from_name ("q"),
+				 GDK_CONTROL_MASK, 0, closure);
+	g_closure_unref (closure);
+	gtk_window_add_accel_group (GTK_WINDOW(win), gtk_accel);
+
 	hbox = gtk_hbox_new (FALSE, 6);
 
 	treeview = pgd_demo_list_create ();
commit 684b47727ba810ad6bf239e2838aa65b6f6cec36
Author: Adrian Johnson <ajohnson at redneon.com>
Date:   Sun Mar 4 18:10:49 2012 +1030

    glib demo: show font encoding in font demo

diff --git a/glib/demo/fonts.c b/glib/demo/fonts.c
index bbc9b8a..24eb87c 100644
--- a/glib/demo/fonts.c
+++ b/glib/demo/fonts.c
@@ -157,12 +157,17 @@ pgd_fonts_fill_model (PgdFontsDemo *demo)
 			const gchar *embedded;
 			const gchar *substitute;
 			const gchar *filename;
+			const gchar *encoding;
 			gchar       *details;
 
 			name = poppler_fonts_iter_get_name (fonts_iter);
 			if (!name)
 				name = "No name";
 
+			encoding = poppler_fonts_iter_get_encoding (fonts_iter);
+			if (!encoding)
+				encoding = "None";
+
 			type = font_type_to_string (poppler_fonts_iter_get_font_type (fonts_iter));
 			
 			if (poppler_fonts_iter_is_embedded (fonts_iter)) {
@@ -178,9 +183,9 @@ pgd_fonts_fill_model (PgdFontsDemo *demo)
 			filename = poppler_fonts_iter_get_file_name (fonts_iter);
 
 			if (substitute && filename)
-				details = g_markup_printf_escaped ("%s\n%s, substituting with <b>%s</b>\n(%s)", type, embedded, substitute, filename);
+				details = g_markup_printf_escaped ("%s\nEncoding: %s\n%s, substituting with <b>%s</b>\n(%s)", type, encoding, embedded, substitute, filename);
 			else
-				details = g_markup_printf_escaped ("%s\n%s", type, embedded);
+				details = g_markup_printf_escaped ("%s\nEncoding: %s\n%s", type, encoding, embedded);
 
 			gtk_list_store_append (GTK_LIST_STORE (model), &iter);
 			gtk_list_store_set (GTK_LIST_STORE (model), &iter,
commit 48c08d28645d82ab9d67433a0150f6e1ba24b7c6
Author: Adrian Johnson <ajohnson at redneon.com>
Date:   Sun Mar 4 17:49:56 2012 +1030

    glib: add poppler_fonts_iter_get_encoding

diff --git a/glib/poppler-document.cc b/glib/poppler-document.cc
index 59124b5..c6108d4 100644
--- a/glib/poppler-document.cc
+++ b/glib/poppler-document.cc
@@ -1788,6 +1788,32 @@ poppler_fonts_iter_get_font_type (PopplerFontsIter *iter)
 }
 
 /**
+ * poppler_fonts_iter_get_encoding:
+ * @iter: a #PopplerFontsIter
+ *
+ * Returns the encoding of the font associated with @iter
+ *
+ * Returns: the font encoding
+ *
+ * Since: 0.20
+ */
+const char *
+poppler_fonts_iter_get_encoding (PopplerFontsIter *iter)
+{
+	GooString *encoding;
+	FontInfo *info;
+
+	info = (FontInfo *)iter->items->get (iter->index);
+
+	encoding = info->getEncoding();
+	if (encoding != NULL) {
+		return encoding->getCString();
+	} else {
+		return NULL;
+	}
+}
+
+/**
  * poppler_fonts_iter_is_embedded:
  * @iter: a #PopplerFontsIter
  *
diff --git a/glib/poppler-document.h b/glib/poppler-document.h
index d29ef6b..7051830 100644
--- a/glib/poppler-document.h
+++ b/glib/poppler-document.h
@@ -249,6 +249,7 @@ 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);
+const char       *poppler_fonts_iter_get_encoding  (PopplerFontsIter *iter);
 gboolean	  poppler_fonts_iter_is_embedded   (PopplerFontsIter  *iter);
 gboolean	  poppler_fonts_iter_is_subset     (PopplerFontsIter  *iter);
 gboolean          poppler_fonts_iter_next          (PopplerFontsIter  *iter);
diff --git a/glib/reference/poppler-sections.txt b/glib/reference/poppler-sections.txt
index 08df585..5a6708b 100644
--- a/glib/reference/poppler-sections.txt
+++ b/glib/reference/poppler-sections.txt
@@ -158,6 +158,7 @@ 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_get_encoding
 poppler_fonts_iter_is_embedded
 poppler_fonts_iter_is_subset
 poppler_fonts_iter_next


More information about the poppler mailing list