box pager_rep::pages_format (array<page_item> l, SI ht, SI tcor, SI bcor) { // cout << "Formatting insertion of height " << ht << LF; ht -= (tcor + bcor); int i, n= N(l); array<box> bs; array<space> spc; for (i=0; i<n; i++) { page_item item= l[i]; if (item->type == PAGE_CONTROL_ITEM) { if (is_tuple (item->t, "env_page")) { if (((item->t[1] == PAGE_THIS_HEADER) || (item->t[1] == PAGE_THIS_FOOTER)) && (item->t[2] == "")) style (item->t[1]->label)= " "; else if (item->t[1] == PAGE_NR) page_offset= as_int (item->t[2]->label)- N(pages)- 1; else style (item->t[1]->label)= copy (item->t[2]); } } else { bs << item->b; spc << item->spc; } } if (N(bs) == 0) { box b= empty_box (decorate_middle (ip), 0, -ht, 0, 0); return vcorrect_box (b->ip, b, tcor, bcor); } else { box b= format_stack (ip, bs, spc, ht, true); return vcorrect_box (b->ip, b, tcor, bcor); } }
box format_stack (path ip, array<page_item> l, SI height, bool may_stretch) { int i, n= N(l); array<box> bs (n); array<space> spc (n); for (i=0; i<n-1; i++) { bs [i]= l[i]->b; spc[i]= l[i]->spc; } if (i<n) bs [i]= l[i]->b; return format_stack (ip, bs, spc, height, may_stretch); }