r18795 - gnucash/trunk/src/html - If building for WIN32, use webkit_web_frame_print_full() so that a GtkPrintOperation object with the correct units can be used to prevent font size problems (see bug 591177). On other platforms, use webkit_web_frame_print() because some distros seem not to have webkit_web_frame_print_full() (and also don't have the font size problem so on those distros, we don't need to create our own GtkPrintOperation object).

Phil Longstaff plongstaff at code.gnucash.org
Wed Mar 3 11:49:50 EST 2010


Author: plongstaff
Date: 2010-03-03 11:49:49 -0500 (Wed, 03 Mar 2010)
New Revision: 18795
Trac: http://svn.gnucash.org/trac/changeset/18795

Modified:
   gnucash/trunk/src/html/gnc-html-webkit.c
Log:
If building for WIN32, use webkit_web_frame_print_full() so that a GtkPrintOperation object with the correct units can be used to prevent font size problems (see bug 591177).  On other platforms, use webkit_web_frame_print() because some distros seem not to have webkit_web_frame_print_full() (and also don't have the font size problem so on those distros, we don't need to create our own GtkPrintOperation object).


Modified: gnucash/trunk/src/html/gnc-html-webkit.c
===================================================================
--- gnucash/trunk/src/html/gnc-html-webkit.c	2010-03-03 11:14:12 UTC (rev 18794)
+++ gnucash/trunk/src/html/gnc-html-webkit.c	2010-03-03 16:49:49 UTC (rev 18795)
@@ -986,18 +986,31 @@
     }
 }
 
-#define PRINT_WITH_OP 1
-
+/**
+ * Prints the current page.
+ *
+ * If printing on WIN32, in order to prevent the font from being tiny, (see bug #591177),
+ * A GtkPrintOperation object needs to be created so that the unit can be set, and then
+ * webkit_web_frame_print_full() needs to be called to use that GtkPrintOperation.  On
+ * other platforms (specifically linux - not sure about MacOSX), the version of webkit may
+ * not contain the function webkit_web_frame_print_full(), so webkit_web_frame_print() is
+ * called instead (the font size problem doesn't show up on linux).
+ *
+ * @param self HTML renderer object
+ */
 static void
 impl_webkit_print( GncHtml* self )
 {
-    extern void webkit_web_frame_print( WebKitWebFrame * frame );
+#ifdef G_OS_WIN32
     extern GtkPrintOperationResult webkit_web_frame_print_full( WebKitWebFrame * frame,
             GtkPrintOperation * op, GtkPrintOperationAction action, GError** error );
+#else
+    extern void webkit_web_frame_print( WebKitWebFrame * frame );
+#endif
 
     GncHtmlWebkitPrivate* priv;
     WebKitWebFrame* frame;
-#if PRINT_WITH_OP
+#ifdef G_OS_WIN32
     GtkPrintOperation* op = gtk_print_operation_new();
     GError* error = NULL;
 #endif
@@ -1005,7 +1018,7 @@
     priv = GNC_HTML_WEBKIT_GET_PRIVATE(self);
     frame = webkit_web_view_get_main_frame( priv->web_view );
 
-#if PRINT_WITH_OP
+#ifdef G_OS_WIN32
     gtk_print_operation_set_unit( op, GTK_UNIT_POINTS );
     webkit_web_frame_print_full( frame, op, GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG, &error );
     g_object_unref( op );



More information about the gnucash-changes mailing list