static box make_ornament_body (path ip, array<page_item> l) { int i, n= N(l); array<box> lines_bx (n); array<SI> lines_ht (n); for (i=0; i<n; i++) { page_item item= copy (l[i]); lines_bx[i]= item->b; lines_ht[i]= item->spc->def; } box b= stack_box (ip, lines_bx, lines_ht); SI dy= n==0? 0: b[0]->y2; return move_box (decorate (ip), stack_box (ip, lines_bx, lines_ht), 0, dy); }
box format_stack (path ip, array<box> bx, array<space> ht) { int i, n= N(bx); array<SI> spc (n); for (i=0; i<n-1; i++) spc[i]= ht[i]->def; return stack_box (ip, bx, spc); }
box format_stack (path ip, array<page_item> l) { int i, n= N(l); array<box> bs (n); array<SI> spc (n); for (i=0; i<n-1; i++) { bs [i]= l[i]->b; spc[i]= l[i]->spc->def; } if (i<n) bs [i]= l[i]->b; return stack_box (ip, bs, spc); }
box format_stack (path ip, array<box> bx, array<space> ht, SI height, bool may_stretch) { int i, n= N(bx); array<SI> spc (n); space total (0); for (i=0; i<n-1; i++) total += space (bx[i]->h()) + ht[i]; total += space (bx[i]->h()); // stretching case if (may_stretch && (total->def < height) && (total->max > total->def)) { double f= ((double) (height - total->def)) / ((double) (total->max - total->def)); for (i=0; i<n-1; i++) spc[i]= ht[i]->def+ ((SI) (f*((double) ht[i]->max- ht[i]->def))); } // shrinking case else if ((total->def > height) && (total->def > total->min)) { double f= ((double) (total->def - height)) / ((double) (total->def - total->min)); if (f>1.0) f=1.0; for (i=0; i<n-1; i++) spc[i]= ht[i]->def- ((SI) (f*((double) ht[i]->def- ht[i]->min))); } // normal case else for (i=0; i<n-1; i++) spc[i]= ht[i]->def; return stack_box (ip, bx, spc); }