[poppler] glib patches

Carlos Garcia Campos carlosgc at gnome.org
Tue Feb 28 09:39:47 PST 2012


Excerpts from Adrian Johnson's message of mar feb 28 12:15:57 +0100 2012:
> Here are some patches that:
> - add poppler_fonts_iter_get_substitute_name to the api
> - make the glib demo show the substitute name
> - add a copy button to the selections demo

Look good to me in general, thanks! some minor comments below.

diff --git a/glib/poppler-document.cc b/glib/poppler-document.cc
index bf83bf0..73bf949 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 *file;

file? please use something like name or font_name

diff --git a/glib/poppler-document.h b/glib/poppler-document.h
index 4ab17c8..4049487 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);

Place the * next to the method name like the other methods.

 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-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

You could also add a new index for 0.20 symbols in poppler-docs.sgml.

diff --git a/glib/demo/fonts.c b/glib/demo/fonts.c
index 07ea589..50bedbd 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);

Indentation doesn't look correct. So, there's always a substitue name
when the font is not embedded?, or is it possible that filename is not
NULL and substitute is NULL?

 static void
+pgd_selections_copy (GtkButton         *button,
+		     PgdSelectionsDemo *demo)
+{
+	if (demo->selected_text) {
+		GtkClipboard *clipboard = gtk_clipboard_get_for_display(gdk_display_get_default(),
+									GDK_SELECTION_CLIPBOARD);
+		gtk_clipboard_set_text (clipboard, demo->selected_text, -1);
+	}
+}
+

Do we need this check? the button is only sensitive when there's
text.

Btw, I prefer bugzilla to review patches, because my email client
doesn't allow me to include attachments as quoted text when replying.

Thanks!
-- 
Carlos Garcia Campos
PGP key: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x523E6462
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/poppler/attachments/20120228/54d26660/attachment.pgp>


More information about the poppler mailing list