Still in time to change the table print ?

Dirk Hohndel dirk at hohndel.org
Wed Feb 13 15:15:22 PST 2013


Hi Salvador

Salvador Cuñat <salvador.cunat at gmail.com> writes:

> Good night.
>
> Attached is a patch to change the table printout which involves major
> changes in this mode, so there's attached too an example .pdf with some
> old dives I've selected because involves locations with 1, 2 and 3 lines
> of text.

I am somewhat more willing to take late changes to print.c because they
clearly have no other side effects and as these changes seem to
demonstrably improve the printout result I might still add them, once
they have been tested on Windows and Mac as well.

> If we don't scale up the fonts there would be room for 40/45 dives per
> page but things would really get too tight.

Yeah, that seems excessive

> The remaining problem is, still, that we don't have a real variable size
> printout, as the number of pages is set in begin_print() and it is
> depending on the number of dives per page.

So you cannot calculate a maximum number of pages (assuming, let's say,
25 dives per page) and then simply stop printing once all dives are
printed?

Alternatively you could pre-render the table printout and then set the
number of pages afterwards (contrary to the profiles, this pre-rendering
should take almost no time).

> diff --git a/print.c b/print.c
> index a59456b..aa1505d 100644
> --- a/print.c
> +++ b/print.c
> @@ -477,25 +477,17 @@ static void show_dive_tanks(struct dive *dive, cairo_t *cr, double w,
>  	g_object_unref (layout);
>  }
>  
> -static void show_table_header(cairo_t *cr, double w, double h,
> -	PangoFontDescription *font)
> +static void show_table_header(cairo_t *cr, PangoLayout *layout, double w)
>  {
>  	int i;
> -	double maxwidth, maxheight, colwidth, curwidth;
> -	PangoLayout *layout;
> -	char headers[7][80]= { N_("Dive#"), N_("Date"), N_("Depth"), N_("Duration"), N_("Master"),
> +	double maxwidth, colwidth, curwidth;
> +	char headers[7][80]= { N_("Dive#"), N_("Date"), N_("Depth"), N_("Time"), N_("Master"),

This makes me nervous. You changed the text back from Duration to Time -
this is something that Miika fixed 4 days ago. Regressions like this are
quite annoying, especially this late before the release. And of course
that means I now need to go through every other line of your patch with
a very fine tooth comb...

/D


More information about the subsurface mailing list