+ /* If we're shrinking tables to fit the page length, then adjust the scale
+ factor.
+
+ XXX This will sometimes shrink more than needed, because adjusting the
+ scale factor allows for cells to be "wider", which means that sometimes
+ they won't break across as much vertical space, thus shrinking the table
+ vertically more than the scale would imply. Shrinking only as much as
+ necessary would require an iterative search. */
+ if (table_item->pt && table_item->pt->look->shrink_to_fit[V])
+ {
+ int total_height = 0;
+ for (size_t i = 0; i < p->n_pages; i++)
+ total_height += table_width (p->pages[i], V);
+ if (total_height * p->scale >= params->size[V])
+ p->scale *= params->size[V] / (double) total_height;
+ }
+