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 concater_rep::marker (path ip) { if (is_decoration (ip)) ip= path (0, ip); string fn_name= "cmr"; 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 (ip->next, ip->item, "", gfn, blue); a << line_item (MARKER_ITEM, OP_SKIP, b, HYPH_INVALID); }
void Font::make_sentence(std::string s, SDL_Rect box){ for (int i = 0; i < s.size(); i++){ Char ch; Rect text_box(box); text_box.x = box.x + i * box.w; ch.box = text_box; ch.frame = toupper(s[i]) - 'A'; texts.push_back(ch); } }
/*static*/ void hyphenate (line_item item, int pos, line_item& item1, line_item& item2) { path ip= item->b->ip; int x1= is_accessible (ip)? item->b->get_leaf_left_pos (): 0; int x2= is_accessible (ip)? x1+ pos+ 1: 0; box b= item->b; string s = b->get_leaf_string (); font fn = b->get_leaf_font (); pencil pen= b->get_leaf_pencil (); string s1, s2; array<int> hp= item->lan->get_hyphens (s); item->lan->hyphenate (s, pos, s1, s2); item1= line_item (STRING_ITEM, OP_SKIP, shorter_box (ip, text_box (ip, x1, s1, fn, pen), pos+ 1), hp[pos], item->lan); item2= line_item (STRING_ITEM, item->op_type, text_box (ip, x2, s2, fn, pen), item->penalty, item->lan); item2->spc= item->spc; // cout << s << " ---> " << s1 << " " << s2 << "\n"; }
box delimiter_box (path ip, string s, font fn, pencil pen, SI bot, SI top) { SI h= top - bot; string r= get_delimiter (s, fn, h); box b= text_box (ip, 0, r, fn, pen); SI x= -b->x1; SI y= (top + bot - b->y1 - b->y2) >> 1; //cout << s << ", " << bot/PIXEL << " -- " << top/PIXEL // << " -> " << r << "; " << x/PIXEL << ", " << y/PIXEL << "\n"; //cout << " extents: " << b->x1/PIXEL << ", " << b->y1/PIXEL // << "; " << b->x2/PIXEL << ", " << b->y2/PIXEL << "\n"; box mvb= move_box (ip, b, x, y, false, true); return macro_box (ip, mvb, fn); }
box delimiter_box (path ip, string s, font fn, pencil pen, SI bot, SI top, SI mid, SI real_bot, SI real_top) { (void) real_bot; (void) real_top; SI h= top - bot; string r= get_delimiter (s, fn, h); box b= text_box (ip, 0, r, fn, pen); SI x= -b->x1; SI y= (top + bot - b->y1 - b->y2) >> 1; if (b->y2 - b->y1 < h) { y= (mid - b->y1 - b->y2) >> 1; y= min (top - b->y2, y); y= max (bot - b->y1, y); }
void concater_rep::flag_ok (string s, path ip, color col) { path dip = decorate_right (ip); SI h= 4*env->fn->wfn/5; int r, g, b, a; get_rgb_color (col, r, g, b, a); //r= 255- (255 - r)/6; //g= 255- (255 - g)/6; //b= 255- (255 - b)/6; a= a/6; color light= rgb_color (r, g, b, a); int info= env->info_level; if (info == INFO_MINIMAL || info == INFO_SHORT || info == INFO_SHORT_PAPER) { box infob= info_box (dip, h, pencil (col, env->fn->wline), light); if (info == INFO_SHORT_PAPER) { box b= resize_box (ip, infob, 0, 0, 0, env->fn->yx); print (b); } else { box specb= specific_box (ip, infob, "screen", env->fn); print (specb); } } else if (info == INFO_DETAILED || info == INFO_PAPER) { int sz= script (env->fn_size, env->index_level+2); font gfn (tex_font ("ecrm", sz, (int) (env->magn*env->dpi))); box textb= text_box (decorate (ip), 0, s, gfn, col); box flagb= flag_box (dip, textb, h, pencil (col, env->fn->wline), light); if (info == INFO_DETAILED) { box specb= specific_box (ip, flagb, "screen", env->fn); print (specb); } else { box b= resize_box (ip, flagb, 0, 0, 0, env->fn->yx); print (b); } } }