From 1077f321da9f94e98ca70ea464b4b9d457fe60fa Mon Sep 17 00:00:00 2001 From: Phil Longstaff Date: Wed, 3 Mar 2010 16:49:49 +0000 Subject: [PATCH] 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). git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@18795 57a11ea4-9604-0410-9ed3-97b8803252fd --- src/html/gnc-html-webkit.c | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/src/html/gnc-html-webkit.c b/src/html/gnc-html-webkit.c index 9fa9eeaa92..ce30b2629c 100644 --- a/src/html/gnc-html-webkit.c +++ b/src/html/gnc-html-webkit.c @@ -986,18 +986,31 @@ impl_webkit_export_to_file( GncHtml* self, const char *filepath ) } } -#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 @@ impl_webkit_print( GncHtml* self ) 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 );