void concater_rep::ghost (string s, path ip, color col) { if ((N(s)>2) && (s[0]=='<') && (s[N(s)-1]=='>')) { ghost ("<", ip, col); ghost (s (1,N(s)-1), ip, col); ghost (">", ip, col); return; } string fn_name= "cmr"; if (N(s)==1) { if (s[0] == '<') { fn_name= "cmsy"; s= "h"; } else if (s[0] == '>') { fn_name= "cmsy"; s= "i"; } else if (s[0] == '|') { fn_name= "cmsy"; s= "j"; } else if (s[0] == '\\') { fn_name= "cmsy"; s= "n"; } else if (s[0] == '{') { fn_name= "cmsy"; s= "f"; } else if (s[0] == '}') { fn_name= "cmsy"; s= "g"; } } int sz= script (env->fn_size, env->index_level); font gfn (tex_font (fn_name, sz, (int) (env->magn*env->dpi))); box b= text_box (decorate (ip), 0, s, gfn, col); array<box> bs (1); bs[0]= b; a << line_item (STD_ITEM, OP_SKIP, composite_box (decorate (ip), bs), HYPH_INVALID); }
void edit_graphics_rep::set_graphical_object (tree t) { go_box= box (); graphical_object= t; if (N (graphical_object) == 0) return; edit_env env= get_typesetter ()->env; //tree old_fr= env->local_begin (GR_FRAME, (tree) find_frame ()); frame f_env= env->fr; env->fr= find_frame (); if (!is_nil (env->fr)) { int i,n=0; go_box= typeset_as_concat (env, t, path (0)); for (i=0; i<N(go_box); i++) if (go_box[i]!="") n++; if (n) { array<box> bx(n); n=0; for (i=0; i<N(go_box); i++) if (go_box[i]!="") { array<box> bx2(1); array<SI> spc2(1); bx2[0]= go_box[i]; spc2[0]=0; bx[n]= concat_box (path (0), bx2, spc2); n++; } go_box= composite_box (path (0), bx); } } env->fr= f_env; //env->local_end (GR_FRAME, old_fr); }
box page_box (path ip, tree page, int page_nr, SI w, SI h, array<box> bs, array<SI> bs_x, array<SI> bs_y, array<box> decs, array<SI> decs_x, array<SI> decs_y) { box dec; if (N (decs) > 0) dec= composite_box (ip, decs, decs_x, decs_y, false); return tm_new<page_box_rep> (ip, page, page_nr, w, h, bs, bs_x, bs_y, dec); }
box composite_box_rep::transform (frame fr) { int i; array<box> bs; for (i= 0; i<subnr(); i++) { if (!is_nil (subbox (i))) { box sb= subbox (i)->transform (fr); if (!is_nil (sb)) bs << sb; } } return N (bs)==0?box ():composite_box (ip, bs); }
box wide_check_box (path ip, SI x1, SI x2, pencil pen) { SI width, height; get_wide_parameters (x1, x2, pen, width, height); array<box> bs (2); array<SI> xs (2); array<SI> ys (2); xs[0]= ys[0]= xs[1]= ys[1]= 0; bs[0]= line_box (decorate_middle (ip), 0, height, width/2, 0, pen); bs[1]= line_box (decorate_middle (ip), width/2, 0, width, height, pen); return composite_box (ip, bs, xs, ys); }
box wide_sqobr_box (path ip, SI x1, SI x2, pencil pen) { SI penw= pen->get_width (); pencil demipen= pencil (pen->get_color (), penw/2); path dip= decorate_middle (ip); SI width= max (x2-x1, 6*penw), height= 6*penw; array<box> bs (3); array<SI> xs (3); array<SI> ys (3); xs[0]= ys[0]= xs[1]= ys[1]= xs[2]= ys[2]= 0; bs[0]= line_box (dip, 0, height, width, height, pen); bs[1]= line_box (dip, 0, height, 0, 0, demipen); bs[2]= line_box (dip, width, height, width, 0, demipen); return composite_box (ip, bs, xs, ys); }
box wide_vect_box (path ip, SI x1, SI x2, pencil pen) { SI penw= pen->get_width (); SI width, height, arrow= 2*penw, delta=penw/2; get_wide_parameters (x1, x2, pen, width, height); height= 10*penw; array<box> bs (3); array<SI> xs (3); array<SI> ys (3); xs[0]= ys[0]= xs[1]= ys[1]= xs[2]= ys[2]= 0; bs[0]= line_box (decorate_middle (ip), 0, arrow, width, arrow, pen); bs[1]= line_box (decorate_middle (ip), width- arrow- delta, 0, width, arrow, pen); bs[2]= line_box (decorate_middle (ip), width+ delta- arrow, 2*arrow, width, arrow, pen); return composite_box (ip, bs, xs, ys); }
box typeset_as_box (edit_env env, tree t, path ip) { box b= typeset_as_concat (env, t, ip); SI ox= 0; int i, n=N(b); for (i=0; i<n; i++) if (b[i]->w() != 0) ox= b[i]->x1; array<box> bs (1); array<SI> xs (1); array<SI> ys (1); bs[0]= b; xs[0]= ox; ys[0]= 0; return composite_box (ip, bs, xs, ys); }
void concater_rep::typeset_anim_accelerate (tree t, path ip) { if (N(t) != 2) { typeset_error (t, ip); return; } path uip= undecorate (ip); while (!has_subtree (the_et, reverse (uip))) uip= uip->next; player apl= get_player (uip); if (!is_nil (uip) && !has_player (uip)) { path aip= search_animation_ip (uip); player pl = is_nil (aip)? player (): get_player (aip); apl= accelerate (pl, t[1]); tree st= subtree (the_et, reverse (uip)); blackbox bb= close_box<player> (apl); (void) tree_addendum_new (st, ADDENDUM_PLAYER, bb, false); } box b= typeset_as_concat (env, t[0], descend (ip, 0)); apl->set_duration (b->anim_duration ()); array<box> bs; bs << b; print (composite_box (ip, bs)); }
box wide_tilda_box (path ip, SI x1, SI x2, pencil pen) { SI width, height, w, h, uw, hh; get_wide_parameters (x1, x2, pen, width, height); h = height/2; hh= (SI) (0.8660254 * ((double) h)); w = width; uw= (SI) (((double) w) / 4.2679492); array<box> bs (3); array<SI> xs (3); array<SI> ys (3); xs[0]= ys[0]= xs[1]= ys[1]= xs[2]= ys[2]= 0; bs[0]= arc_box (decorate_middle (ip), 0, -h, 2*uw, h, 60<<6, 180<<6, pen); bs[1]= line_box (decorate_middle (ip), 3*uw/2, hh, w-(3*uw/2), h-hh, pen); bs[2]= arc_box (decorate_middle (ip), w- (2*uw), 0, w, 2*h, 240<<6, 360<<6, pen); return composite_box (ip, bs, xs, ys); }