Re: GtkPrintOperation uses wrong scale on Windows ?
Geert Janssens wrote: > I rewrote my code to no longer use cairo_identity_matrix (altering some > of our own transformations to cope with this), and now the pages print > fine on Windows as well. Good deal. I'm glad you figured it out. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: GtkPrintOperation uses wrong scale on Windows ?
On 27-06-12 11:34, Geert Janssens wrote: On 26-06-12 16:29, Michael Cronenworth wrote: Geert Janssens wrote: Am I doing something wrong here ? Was GNUCash setting units before? If so, what to? It was. This setting has never changed since 2007, while the bug first appeared in 2010. Your question make me realize I may be chasing the wrong tail here. Instead I am now comparing changes between the last known working version and the one first reported to be failing. There's only about a hundred commits in between and each rebuild on my Windows test machine takes a couple of hours... :( I have identified one change that could be a good candidate and I'm now testing my theories with this one reverted. We'll see the result later today. Thanks for the feedback so far. Geert ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list I found my issue, and it was indeed a completely different one. I'll share my experience here in case others hit the same problem. The GnuCash code called cairo_identity_matrix on the cairo_t obtained via gtk_print_context_get_cairo_context with the intention to start form a clean cairo_t to write our checks to. cairo_identity_matrix removes all transformations from a cairo_t, in the process resetting its resolution to 72dpi. On linux this doesn't make a difference because GtkPrintContext works with a 72dpi resolution internally. On Windows though, the cairo_t returned by gtk_print_context_get_cairo_context has the resolution of the printer (eg 600dpi). I suppose GtkPrintContext already set a transformation on the context to achieve this. Resetting the cairo_t also removes this internally set up transformation, ruining the complete page setup. I don't think this description is not 100% accurate. I believe a cairo_t doesn't really have a resolution. But in the context of printing this is close enough to explain what went wrong. I rewrote my code to no longer use cairo_identity_matrix (altering some of our own transformations to cope with this), and now the pages print fine on Windows as well. Geert ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: GtkPrintOperation uses wrong scale on Windows ?
On 26-06-12 16:29, Michael Cronenworth wrote: Geert Janssens wrote: Am I doing something wrong here ? Was GNUCash setting units before? If so, what to? It was. This setting has never changed since 2007, while the bug first appeared in 2010. Your question make me realize I may be chasing the wrong tail here. Instead I am now comparing changes between the last known working version and the one first reported to be failing. There's only about a hundred commits in between and each rebuild on my Windows test machine takes a couple of hours... :( I have identified one change that could be a good candidate and I'm now testing my theories with this one reverted. We'll see the result later today. Thanks for the feedback so far. Geert ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: GtkPrintOperation uses wrong scale on Windows ?
Allin Cottrell wrote: > Sorry, I don't have a solution, but I can confirm the problem. It has > been there for a long time (since GTK 2.16 or earlier). > > When I first came across the issue I tried messing with the GTK_UNIT_* > arguments till I was blue in the face, to no avail. I also tried > inserting debugging statements much like yours, but couldn't work > exactly where the problem lay. Eventually I just gave up on using > GtkPrintOperation on Windows. I hope you have better luck! We may not be using GtkPrintOperation the same way, but I do not have a problem with Windows printing. I'm using GTK_UNITS_MM and images or text print in the same location with the same resolution on Linux and Windows. GTK 2.24.10 and Cairo 1.11.2. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: GtkPrintOperation uses wrong scale on Windows ?
On Tue, 26 Jun 2012, Geert Janssens wrote: GnuCash is using GtkPrintOperation (Gtk2.24) to print checks. On linux this has always worked fine, but on Windows we have major scaling problems. There is a bugreport for this [1], which I am trying to solve for quite some time now. A check that should be printed page-wide actually appears in a tiny 1-inch area on the page. [...] Sorry, I don't have a solution, but I can confirm the problem. It has been there for a long time (since GTK 2.16 or earlier). When I first came across the issue I tried messing with the GTK_UNIT_* arguments till I was blue in the face, to no avail. I also tried inserting debugging statements much like yours, but couldn't work exactly where the problem lay. Eventually I just gave up on using GtkPrintOperation on Windows. I hope you have better luck! -- Allin Cottrell Department of Economics Wake Forest University, NC ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: GtkPrintOperation uses wrong scale on Windows ?
Geert Janssens wrote: > Am I doing something wrong here ? Was GNUCash setting units before? If so, what to? ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
GtkPrintOperation uses wrong scale on Windows ?
Hi, GnuCash is using GtkPrintOperation (Gtk2.24) to print checks. On linux this has always worked fine, but on Windows we have major scaling problems. There is a bugreport for this [1], which I am trying to solve for quite some time now. A check that should be printed page-wide actually appears in a tiny 1-inch area on the page. So far I have discovered that it is printer-resolution dependent. The 1-inch area is what you get when the printer's resolution is set to 600dpi. Setting the printer resolution to 72 dpi, the checks are printed properly. I did find a cairo mailing list message [2] that suggests this would be fixed by using gtk_print_operation_set_unit() to set the unit to GTK_UNIT_POINTS, but this has already been added without any effect. Here are some more details: * The code that creates the print operation looks like this: print = gtk_print_operation_new(); /* some code to set job title and load printer settings omitted here */ gtk_print_operation_set_unit(print, GTK_UNIT_POINTS); gtk_print_operation_set_use_full_page(print, TRUE); g_signal_connect(print, "begin_print", G_CALLBACK(begin_print), pcd); g_signal_connect(print, "draw_page", G_CALLBACK(draw_page), pcd); res = gtk_print_operation_run(print, GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG, pcd->caller_window, NULL); * The callback "begin_print" calculates the number of pages to print, based on a simple algorithm that a fixed number of checks fits on one page. Nothing in this code could have any effect on the resolution * At the beginning of the "draw_page" callback I have added some diagnostic debug messages: PINFO("width: %f, xres: %f, yres: %f", gtk_print_context_get_width (context), gtk_print_context_get_dpi_x (context), gtk_print_context_get_dpi_y (context)); Which would print this line to our debug output (for a 600dpi printer resolution): INFO [draw_page] width: 595,275591, xres: 600,00, yres: 600,00 This matches the result on paper: 595 units at 600dpi is about 1 inch, but is clearly not what we had in mind. 595 units roughly matches the width of a US letter paper minus margins at 72 dpi. As I understood, setting unit to GTK_UNIT_POINTS via gtk_print_operation_set_unit should have changed all this: I would either have expected a resolution of 72 dpi or a much larger page width. As said before, this is all using Gtk 2.24, and on linux this works fine. The debug line on linux gives this: INFO [draw_page] width: 595.275591, xres: 72.00, yres: 72.00 Am I doing something wrong here ? Thanks, Geert [1] https://bugzilla.gnome.org/show_bug.cgi?id=631611 [2] http://comments.gmane.org/gmane.comp.lib.cairo/19686 ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list