예제 #1
0
void synch_pos_with_cur(posstructure * pos, posstructure * refpos, scaledpos cur)
{
    switch (pos->dir) {
        case dir_TLT:
            pos->pos.h = refpos->pos.h + cur.h;
            pos->pos.v = refpos->pos.v - cur.v;
            break;
        case dir_TRT:
            pos->pos.h = refpos->pos.h - cur.h;
            pos->pos.v = refpos->pos.v - cur.v;
            break;
        case dir_LTL:
            pos->pos.h = refpos->pos.h + cur.v;
            pos->pos.v = refpos->pos.v - cur.h;
            break;
        case dir_RTT:
            pos->pos.h = refpos->pos.h - cur.v;
            pos->pos.v = refpos->pos.v - cur.h;
            break;
        default:
            formatted_warning("pdf backend","forcing bad dir %i to TLT in synch_pos_with_cur",pos->dir);
            pos->dir = dir_TLT;
            pos->pos.h = refpos->pos.h + cur.h;
            pos->pos.v = refpos->pos.v - cur.v;
            break;
    }
}
예제 #2
0
void print(int s)
{
if(s>=str_ptr){
normal_warning("print","bad string pointer");
return;
}else if(s<STRING_OFFSET){
if(s<0){
normal_warning("print","bad string offset");
}else{

if((false)&&(selector> pseudo)){

print_char(s);
return;
}
if(s==new_line_char_par){
if(selector<pseudo){
print_ln();
return;
}
}
if(s<=0x7F){
print_char(s);
}else if(s<=0x7FF){
print_char(0xC0+(s/0x40));
print_char(0x80+(s%0x40));
}else if(s<=0xFFFF){
print_char(0xE0+(s/0x1000));
print_char(0x80+((s%0x1000)/0x40));
print_char(0x80+((s%0x1000)%0x40));
}else if(s>=0x110000){
int c= s-0x110000;
if(c>=256){
formatted_warning("print","bad raw byte to print (c=%d), skipped",c);
}else{
print_char(c);
}
}else{
print_char(0xF0+(s/0x40000));
print_char(0x80+((s%0x40000)/0x1000));
print_char(0x80+(((s%0x40000)%0x1000)/0x40));
print_char(0x80+(((s%0x40000)%0x1000)%0x40));
}
}
return;
}
if(selector==new_string){
append_string(str_string(s),(unsigned)str_length(s));
return;
}
lprint(&str_lstring(s));
}
예제 #3
0
static void checkpdfrestore(scaledpos pos)
{
scaledpos diff;
if(pos_stack_used==0){
normal_warning("pdf backend","'restore' is missing a 'save'");
return;
}
pos_stack_used--;
diff.h= pos.h-pos_stack[pos_stack_used].pos.h;
diff.v= pos.v-pos_stack[pos_stack_used].pos.v;
if(diff.h!=0||diff.v!=0){
formatted_warning("pdf backend","misplaced 'restore' by (%dsp, %dsp)",(int)diff.h,(int)diff.v);
}
if(global_shipping_mode==SHIPPING_PAGE){
matrix_stack_used= pos_stack[pos_stack_used].matrix_stack;
}
}
예제 #4
0
USHORT tt_add_glyph(struct tt_glyphs * g, USHORT gid, USHORT new_gid)
{
    if (g->used_slot[new_gid / 8] & (1 << (7 - (new_gid % 8)))) {
        formatted_warning("ttf","slot %u already used", new_gid);
    } else {
        if (g->num_glyphs + 1 >= NUM_GLYPH_LIMIT)
            normal_error("ttf","too many glyphs");

        if (g->num_glyphs >= g->max_glyphs) {
            g->max_glyphs = (USHORT) (g->max_glyphs + GLYPH_ARRAY_ALLOC_SIZE);
            g->gd = RENEW(g->gd, g->max_glyphs, struct tt_glyph_desc);
        }
        g->gd[g->num_glyphs].gid = new_gid;
        g->gd[g->num_glyphs].ogid = gid;
        g->gd[g->num_glyphs].length = 0;
        g->gd[g->num_glyphs].data = NULL;
        g->used_slot[new_gid / 8] = (unsigned char) (g->used_slot[new_gid / 8] | (1 << (7 - (new_gid % 8))));
        g->num_glyphs++;
    }
예제 #5
0
static int run_build(lua_State * L)
{
    if (lua_type(L, 1) == LUA_TNUMBER) {
        int cs = 0;
        int chr = (int) lua_tointeger(L, 1);
        int cmd = (int) luaL_optinteger(L, 2, get_cat_code(cat_code_table_par,chr));
        if (cmd == 0 || cmd == 9 || cmd == 14 || cmd == 15) {
            formatted_warning("token lib","not a good token, catcode %i can not be returned, so 12 will be used",(int) cmd);
            cmd = 12;
        } else if (cmd == 13) {
            cs = active_to_cs(chr, false);
            cmd = eq_type(cs);
            chr = equiv(cs);
        }
        make_new_token(L, cmd, chr, cs);
        return 1;
    } else {
        return run_lookup(L);
    }
}
예제 #6
0
void print_char(int s)
{
if(s<0||s> 255){
formatted_warning("print","weird character %i",s);
return;
}
if(s==new_line_char_par){
if(selector<pseudo){
print_ln();
return;
}
}
switch(selector){
case no_print:
break;
case term_only:
fix_term_offset(s);
wterm_char(s);
incr(term_offset);
if(term_offset==max_print_line){
wterm_cr();
term_offset= 0;
}
break;
case log_only:
fix_log_offset(s);
wlog(s);
incr(file_offset);
if(file_offset==max_print_line){
wlog_cr();
file_offset= 0;
}
break;
case term_and_log:
fix_term_offset(s);
fix_log_offset(s);
wterm_char(s);
wlog(s);
incr(term_offset);
incr(file_offset);
if(term_offset==max_print_line){
wterm_cr();
term_offset= 0;
}
if(file_offset==max_print_line){
wlog_cr();
file_offset= 0;
}
break;
case pseudo:
if(tally<trick_count)
trick_buf[tally%error_line]= (packed_ASCII_code)s;
break;
case new_string:
append_char(s);
break;
default:
fprintf(write_file[selector],"%c",s);
}
incr(tally);
}