Re: [PATCH] Inconsistent read/write of a GtkPaperSize to GKeyFile



Andrea wrote:
> Andrea wrote:
>>
>> I attach a patch to fix the way values as read (MM rather than POINTS).
>> I have not tested it yet (I need to recompile GTK's rpm source), but I am pretty confident.
> 
> Ok, it does work completely.
> One thing is solved (i.e. paper sizes are not modified by reading and writing).
> But some part of the code needs them to be in POINTS (e.g. gtkprintbackendcups.c, function
> create_page_setup)
> 
> So what happens now is that the sizes are overscaled...
> 
> I will try to change them boths to POINTS rather than MM.
> 
> Anyone has an idea?

Ok, I've found how to fix it.
The error is in gtk_paper_size_new_from_key_file() which calls gtk_paper_size_new_from_ppd() with
height and width in MM while gtk_paper_size_new_from_ppd() needs POINTS.
In my first attempt I did not read properly the documentation.

The easy fix is to convert them to POINTS before calling gtk_paper_size_new_from_ppd().

The new patch fixes the read/write issue and gives the correct sizes for all sizes.

GIMP works well with that patch.

Cheers

--- gtkpapersize.c.old	2009-01-21 20:50:06.000000000 +0000
+++ gtkpapersize.c	2009-01-21 22:15:53.000000000 +0000
@@ -853,7 +853,8 @@
 
   if (ppd_name != NULL)
     paper_size = gtk_paper_size_new_from_ppd (ppd_name, display_name,
-			                      width, height);
+			                      _gtk_print_convert_from_mm(width, GTK_UNIT_POINTS), 
+					      _gtk_print_convert_from_mm(height, GTK_UNIT_POINTS));
   else if (name != NULL)
     paper_size = gtk_paper_size_new_custom (name, display_name,
 					    width, height, GTK_UNIT_MM);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]