static void set_font(PDF pdf) { pdfstructure *p = pdf->pstruct; if (p->need_width != 0) { pdf_printf(pdf, "%0.3f w\n",((7227.0/7200.0)/1000.0) * p->need_width ); p->done_width = 1; } else if (p->done_width) { pdf_puts(pdf, "0 w\n"); p->done_width = 0; } if (p->need_mode != 0) { pdf_printf(pdf, "%d Tr\n", (int) p->need_mode); p->done_mode = 1; } else if (p->done_mode) { pdf_puts(pdf, "0 Tr\n"); p->done_mode = 0; } pdf_printf(pdf, "/F%d", (int) p->f_pdf); pdf_print_resname_prefix(pdf); pdf_out(pdf, ' '); print_pdffloat(pdf, p->fs); pdf_puts(pdf, " Tf\n"); p->f_pdf_cur = p->f_pdf; p->fs_cur.m = p->fs.m; p->need_tf = false; /*tex Always follow |Tf| by |Tm|: */ p->need_tm = true; }
void pdf_print_charwidth(PDF pdf, internal_font_number f, int i) { pdffloat cw; pdfstructure *p = pdf->pstruct; cw.m = pdf_char_width(p, f, i); cw.e = p->cw.e; print_pdffloat(pdf, cw); }
void pdf_place_rule(PDF pdf,halfword q,scaledpos size,int callback_id) { pdfpos dim; pdfstructure*p= pdf->pstruct; scaledpos pos= pdf->posstruct->pos; if(subtype(q)==box_rule){ pdf_place_form(pdf,q); }else if(subtype(q)==image_rule){ pdf_place_image(pdf,q); }else if(subtype(q)==empty_rule){ }else if(subtype(q)==user_rule){ if(callback_id!=0){ pdf_goto_pagemode(pdf); pdf_puts(pdf,"q\n"); pdf_set_pos_temp(pdf,pos); run_callback(callback_id,"Ndd->",q,size.h,size.v); pdf_puts(pdf,"\nQ\n"); } }else{ pdf_goto_pagemode(pdf); dim.h.m= i64round(size.h*p->k1); dim.h.e= p->pdf.h.e; dim.v.m= i64round(size.v*p->k1); dim.v.e= p->pdf.v.e; pdf_puts(pdf,"q\n"); if(size.v<=one_bp){ pos.v+= i64round(0.5*size.v); pdf_set_pos_temp(pdf,pos); pdf_puts(pdf,"[]0 d 0 J "); print_pdffloat(pdf,dim.v); pdf_puts(pdf," w 0 0 m "); print_pdffloat(pdf,dim.h); pdf_puts(pdf," 0 l S\n"); }else if(size.h<=one_bp){ pos.h+= i64round(0.5*size.h); pdf_set_pos_temp(pdf,pos); pdf_puts(pdf,"[]0 d 0 J "); print_pdffloat(pdf,dim.h); pdf_puts(pdf," w 0 0 m 0 "); print_pdffloat(pdf,dim.v); pdf_puts(pdf," l S\n"); }else{ pdf_set_pos_temp(pdf,pos); pdf_puts(pdf,"0 0 "); print_pdffloat(pdf,dim.h); pdf_out(pdf,' '); print_pdffloat(pdf,dim.v); pdf_puts(pdf," re f\n"); } pdf_puts(pdf,"Q\n"); } }/*:2*/