After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 152939 - Printing should use pango interface to libgnomeprint
Printing should use pango interface to libgnomeprint
Status: RESOLVED FIXED
Product: Gnumeric
Classification: Applications
Component: Printing
git master
Other All
: Normal normal
: ---
Assigned To: Jody Goldberg
Jody Goldberg
: 62210 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2004-09-17 19:45 UTC by Yaacov Zamir
Modified: 2004-12-22 21:47 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
screenshot of the problem (59.63 KB, image/jpeg)
2004-09-17 19:59 UTC, Yaacov Zamir
  Details
a test patch (2.23 KB, patch)
2004-09-18 05:58 UTC, Yaacov Zamir
none Details | Review
screenshot of how the test patch work (45.82 KB, image/jpeg)
2004-09-18 06:01 UTC, Yaacov Zamir
  Details
this patch is an error ! (13.22 KB, patch)
2004-09-19 17:22 UTC, Yaacov Zamir
rejected Details | Review
a working test patch to use cell_calc_layout in print cell (19.98 KB, patch)
2004-09-20 16:22 UTC, Yaacov Zamir
none Details | Review
patch_20092004 screenshot (10.64 KB, image/jpeg)
2004-09-20 16:23 UTC, Yaacov Zamir
  Details
use cell_calc_layout from cell-draw with printing *rv (17.59 KB, patch)
2004-09-21 09:33 UTC, Yaacov Zamir
none Details | Review
a screen shot of patch 21092004 (15.41 KB, image/jpeg)
2004-09-21 09:34 UTC, Yaacov Zamir
  Details
a screen shot of patch 21092004 with hebrew (4.79 KB, image/jpeg)
2004-09-21 09:51 UTC, Yaacov Zamir
  Details
the same as print_cell_c_21092004, some code cleanups. (17.91 KB, patch)
2004-09-21 14:09 UTC, Yaacov Zamir
needs-work Details | Review
header/footer printer patch (if you use hebrew local h/f is printed packword) (2.12 KB, patch)
2004-09-21 17:57 UTC, Yaacov Zamir
none Details | Review
header/footer (update) - i forgot to unref the print layout on the last patch (2.18 KB, patch)
2004-09-21 18:10 UTC, Yaacov Zamir
none Details | Review
Updated header/footer patch (4.26 KB, patch)
2004-09-21 20:04 UTC, Morten Welinder
none Details | Review
i've tried to get the pixels out of cell calc layout (8.67 KB, patch)
2004-09-22 09:04 UTC, Yaacov Zamir
none Details | Review
the same as (id=31816), i just forgon one refence to pixels in calc layout (9.00 KB, patch)
2004-09-22 09:18 UTC, Yaacov Zamir
none Details | Review
gnome print pango layout in graph (3.92 KB, patch)
2004-09-22 10:05 UTC, Yaacov Zamir
none Details | Review

Description Yaacov Zamir 2004-09-17 19:45:28 UTC
Users writing in hebrew and arabic can print in gnumeric (Maybe other locales ?).

Other information:
gnome-print implements pango using gnome_print_pango_layout (..).
but gnumeric in the file print-cell.c use gnome_print_show (..).

the cell is rendered correctly on screen (gtk use pango by default)
but not printed correctly (gnome_print_show() do not use pango)
Comment 1 Jon Kåre Hellan 2004-09-17 19:50:44 UTC
Should that be "can't print in gnumeric"?
Comment 2 Yaacov Zamir 2004-09-17 19:52:23 UTC
Yes it is "can't print in gnumeric" :)
Comment 3 Jody Goldberg 2004-09-17 19:55:49 UTC
gnome_print_pango_layout in 2.6 was a kludge.  We can not use it in 1.2.x
For gnome-print-2.8 it has been revamped and we could consider using it for 1.4
Comment 4 Yaacov Zamir 2004-09-17 19:59:37 UTC
Created attachment 31656 [details]
screenshot of the problem
Comment 5 Yaacov Zamir 2004-09-17 20:04:48 UTC
i will be very happy to print in gnumeric, and if you will use it on 1.4, i will
move to gnumeric 1.4, thank you in advance, kobi.
Comment 6 Yaacov Zamir 2004-09-18 05:58:49 UTC
Created attachment 31661 [details] [review]
a test patch

i've made a patch to test pango printing and i works for me,
i do not think it is up to gnumeric coding tandards, but now i can print :)
Comment 7 Yaacov Zamir 2004-09-18 06:01:42 UTC
Created attachment 31662 [details]
screenshot of how the test patch work
Comment 8 Yaacov Zamir 2004-09-19 17:22:39 UTC
Created attachment 31695 [details] [review]
this patch is an error !

This patch is better :> ( i think )
Comment 9 Yaacov Zamir 2004-09-19 17:34:06 UTC
I forgot, to use this patch (id=31695) you need to make cell_calc_layout not static.
Comment 10 Morten Welinder 2004-09-19 20:45:54 UTC
This was envisioned long ago, but gnome-print couldn't print layouts back then.

I like the ratio of "-" to "+" lines in that patch, btw!
Comment 11 Yaacov Zamir 2004-09-20 08:23:37 UTC
Yes, I liked it too BUT it was a mistake !!!
This patch (id=31695) does NOT work.

1. the cell_calc_layout use int and the print function use double.
2. the cell_calc_layout use the layout from the cell and the print need a new
layout derived from the printing context

solution ?
1. make a new layout cell_calc_layout that get a ready made layout and calculate
the x,y, etc... for screen and printer ( and whatever )
2. create a new layout cell_calc_layout just for the printer ( current solution )
3. something better ?
Comment 12 Morten Welinder 2004-09-20 13:48:48 UTC
It doesn't look too bad.  We could...

1. Make cell_calc_layout take an extra parameter, RenderedValue *rv, from
   which to get the layout.  (Using the rendered value will get indentation
   right.)
2. Have draw_cell supply cell->rendered_value for that argument.
3. Make cell_calc_layout non-static.

What is it we need in floating point?  The rectangle?
Comment 13 Yaacov Zamir 2004-09-20 16:22:36 UTC
Created attachment 31731 [details] [review]
a working test patch to use cell_calc_layout in print cell

in this patch i copied the cell_calc_layout from draw-cell.c
just to see what is needed.

i have a problem with width and hight ( i will attach a screenshot next )

help ?
Comment 14 Yaacov Zamir 2004-09-20 16:23:28 UTC
Created attachment 31732 [details]
patch_20092004 screenshot
Comment 15 Yaacov Zamir 2004-09-21 09:33:43 UTC
Created attachment 31757 [details] [review]
use cell_calc_layout from cell-draw with printing *rv

It finaly work, i'm very happy :) (next is a screenshot)
Comment 16 Yaacov Zamir 2004-09-21 09:34:58 UTC
Created attachment 31758 [details]
a screen shot of patch 21092004
Comment 17 Yaacov Zamir 2004-09-21 09:51:29 UTC
Created attachment 31759 [details]
a screen shot of patch 21092004 with hebrew

i just had to put a screenshot with hebrew :)

p.s. 
the printing argument i added to cell_calc_layout is ugly is there
a better way to let the function know y axis is upside down and to use points
and not pixels ?
Comment 18 Yaacov Zamir 2004-09-21 14:09:28 UTC
Created attachment 31774 [details] [review]
the same as print_cell_c_21092004, some code cleanups.
Comment 19 Yaacov Zamir 2004-09-21 17:57:05 UTC
Created attachment 31787 [details] [review]
header/footer printer patch (if you use hebrew local h/f is printed packword)
Comment 20 Yaacov Zamir 2004-09-21 18:10:57 UTC
Created attachment 31789 [details] [review]
header/footer (update) - i forgot to unref the print layout on the last patch
Comment 21 Morten Welinder 2004-09-21 18:51:52 UTC
that looks pretty good.  I don't know what the dpi should be, but I do know
that gnome_font_get_pango_description ignores it except that it checks for
>0.

It looks like we might want to apply the header/footer patch independently
of the cell draw patch.  Jody?
Comment 22 Yaacov Zamir 2004-09-21 19:43:37 UTC
attachments 31757, 31731 and 31695 should be striked out
Comment 23 Morten Welinder 2004-09-21 20:04:20 UTC
Created attachment 31797 [details] [review]
Updated header/footer patch

This avoid having to require libgnomeprint 2.8 and avoid some minor rounding
issues.

Please test.
Comment 24 Yaacov Zamir 2004-09-21 21:21:34 UTC
It works for me (But i have gnome_print_pango_create_layout)

I loved to see the way you code !

p.s.

I did not find the code for printing labels in graphs, can you point me to it ?
Comment 25 Morten Welinder 2004-09-21 21:33:41 UTC
header/footer patch committed.

I suspect you are looking for the code in
src/cut-n-paste-code/goffice/graph/gog-renderer-gnome-print.c
Comment 26 Jody Goldberg 2004-09-22 06:07:26 UTC
Comment on attachment 31774 [details] [review]
the same as print_cell_c_21092004, some code cleanups.

I like the concept but the interface is too pixel specific to adopt in the
current form.

We'd need to either move to using pango fixed point measurements for both
or produce multiple copies of the pixel code
Comment 27 Yaacov Zamir 2004-09-22 09:04:54 UTC
Created attachment 31816 [details] [review]
i've tried to get the pixels out of cell calc layout

is this in the right direction ?
Comment 28 Yaacov Zamir 2004-09-22 09:10:13 UTC
Oo.. Thank you Morten Welinder, I found the code in the place you showed my :)
Comment 29 Yaacov Zamir 2004-09-22 09:18:36 UTC
Created attachment 31817 [details] [review]
the same as (id=31816), i just forgon one refence to pixels in calc layout
Comment 30 Yaacov Zamir 2004-09-22 10:05:31 UTC
Created attachment 31824 [details] [review]
gnome print pango layout in graph 

The graph part of gnumeric is not working properly ?
I did not test it !! i can't make graphs in my gnumeric cvs (but it compiles).
Comment 31 Morten Welinder 2004-09-22 15:53:35 UTC
You might want to "make clean" and re-run the configuration process.  (That
has solved those problems for others.)

Anyway, graph printing has been committed.  I decided not to create a new layout
for every text fragment as that was a problem recently for screen rendering.
Also, the code has some type issues.
Comment 32 Morten Welinder 2004-09-22 18:06:56 UTC
This cell printing patch still needs work.  To get the ball rolling, I am...
installing these baby-step changes:

2004-09-22  Morten Welinder  <terra@gnome.org>

	* src/rendered-value.c (rendered_value_new): Get rid of quantify
	artefacts.

	* src/cell-draw.c (cell_draw): Get rid of quantify artefacts.
	(cell_calc_layout): Add rv and printing arguments, drop res_layout
	argument.  Make extern.  Caller changed.

and calculating the y_direction (always +1 for now).  Note, that your patch
changed the meaning of

    rect->height = height + 1;
to
    rect->height = height - y_direction * 1;

I did not do that.

Rendered values' ->layout_natural_height and ->layout_natural_width currently
have pixel sizes in them, so we cannot simply use _get_size instead of
_get_pixel_size.  (We might want to change their definition.)
Comment 33 Morten Welinder 2004-09-22 19:01:26 UTC
The skeleton work for cell printing is now in.  To see it in action, do

USE_NEW_PRINT=1 ./gnumeric

It still has a terrible confusion of points an pixels, but I'm sure we can
address that.
Comment 34 Morten Welinder 2004-09-23 15:44:29 UTC
I believe the rounding issues have been addressed to the extent that we should
be accurate to 1/1024 pt.  That's far less than a pixel on even high-end
printers.

It still needs USE_NEW_PRINT=1 to be turned on.
Comment 35 Morten Welinder 2004-09-23 16:00:57 UTC
*** Bug 62210 has been marked as a duplicate of this bug. ***
Comment 36 Yaacov Zamir 2004-09-23 16:11:48 UTC
I finaly got graph to work (I did the make clean...)
but the labels and the numbers jump around both on screen
and on print, is it a problem with my build ? (it did not work at all until now)
Can it be a problem with the patch ? ( the problem is on screen too )
Comment 37 Morten Welinder 2004-09-23 16:38:07 UTC
There was a bug in graph printing (things got placed the wrong spot) until
about an hour ago.
Comment 38 Morten Welinder 2004-09-27 00:20:12 UTC
Stick a fork in it.  It's done.
Thanks for all the help.