r22243 - gnucash/trunk/src/gnome - Bug #631611 - Check printing fails because fonts are too tiny on Windows

Geert Janssens gjanssens at code.gnucash.org
Wed Jun 27 11:52:03 EDT 2012


Author: gjanssens
Date: 2012-06-27 11:52:03 -0400 (Wed, 27 Jun 2012)
New Revision: 22243
Trac: http://svn.gnucash.org/trac/changeset/22243

Modified:
   gnucash/trunk/src/gnome/dialog-print-check.c
Log:
Bug #631611 - Check printing fails because fonts are too tiny on Windows
Lesson learned: don't use cairo_identity_matrix on a cairo_t managed by
GtkPrintContext. It kills a number of transformations that were already
configured by GtkPrintContext. On Windows this breaks proper scaling.

Modified: gnucash/trunk/src/gnome/dialog-print-check.c
===================================================================
--- gnucash/trunk/src/gnome/dialog-print-check.c	2012-06-27 15:51:51 UTC (rev 22242)
+++ gnucash/trunk/src/gnome/dialog-print-check.c	2012-06-27 15:52:03 UTC (rev 22243)
@@ -2271,7 +2271,6 @@
     gdouble x, y, r, multip;
 
     cr = gtk_print_context_get_cairo_context(context);
-    cairo_identity_matrix(cr);
     cairo_translate(cr, format->trans_x, format->trans_y);
     g_debug("Page translated by %f,%f", format->trans_x, format->trans_y);
     cairo_rotate(cr, format->rotation * DEGREES_TO_RADIANS);
@@ -2286,15 +2285,19 @@
                   pcd->default_font);
     }
 
-    /* Translate all subsequent check items if requested. */
-    if ((position >= 0) && (position < pcd->position_max))
+    /* Translate all subsequent check items if requested.
+     * For check position 0, no translation is needed. */
+    if ((position > 0) && (position < pcd->position_max))
     {
-        y = format->height * position;
-        cairo_translate(cr, 0, y);
-        g_debug("Position translated by %f (pre-defined)", y);
+        /* Standard positioning is used.
+         * Note that the first check on the page (position 0) doesn't
+         * need to be moved (hence the test for position > 0 above. */
+        cairo_translate(cr, 0, format->height);
+        g_debug("Position %d translated by %f (pre-defined)", position, format->height);
     }
-    else
+    else if (position == pcd->position_max)
     {
+        /* Custom positioning is used. */
         multip = pcd_get_custom_multip(pcd);
         x = multip * gtk_spin_button_get_value(pcd->translation_x);
         y = multip * gtk_spin_button_get_value(pcd->translation_y);



More information about the gnucash-changes mailing list