/* DF; sets programmable features except P1 and P2 */ int hpgl_DF(hpgl_args_t *pargs, hpgl_state_t *pgls) { hpgl_args_t args; hpgl_call(hpgl_reset_overlay(pgls)); hpgl_args_setup(&args); hpgl_FT(&args, pgls); hpgl_args_setup(&args); hpgl_IW(&args, pgls); hpgl_set_line_attribute_defaults(pgls); hpgl_args_setup(&args); hpgl_LA(&args, pgls); hpgl_set_line_pattern_defaults(pgls); hpgl_args_setup(&args); hpgl_RF(&args, pgls); hpgl_args_set_int(&args, 0); hpgl_SV(&args, pgls); hpgl_args_setup(&args); hpgl_UL(&args, pgls); hpgl_args_setup(&args); hpgl_SB(&args, pgls); return 0; }
void hpgl_do_reset(pcl_state_t * pcs, pcl_reset_type_t type) { /* pgframe.c (Chapter 18) */ hpgl_args_t hpgl_args; if ((type & (pcl_reset_initial | pcl_reset_printer | pcl_reset_cold)) != 0) { if ((type & (pcl_reset_initial | pcl_reset_cold)) != 0) { gx_path_alloc_contained(&pcs->g.polygon.buffer.path, pcs->memory, "hpgl_do_reset polygon buffer"); gs_setlimitclamp(pcs->pgs, true); } else gx_path_new(&pcs->g.polygon.buffer.path); /* provide default anchor point, plot size and picture frame size */ hpgl_default_coordinate_system(pcs); /* we should not have a path at this point but we make sure */ hpgl_clear_current_path(pcs); /* Initialize stick/arc font instances */ hpgl_initialize_stick_fonts(pcs); /* intialize subpolygon started hack flag */ pcs->g.subpolygon_started = false; /* indicates a line down operation has been done in polygon mode */ pcs->g.have_drawn_in_path = false; /* execute only the implicit portion of IN */ hpgl_IN_implicit(pcs); /* we select the default pen 1 here, oddly, IN does not select the default pen even though it sets pen widths and units of measure */ pcs->g.pen.selected = 1; } /* NB check all of these */ if ((type & pcl_reset_page_params) != 0) { /* provide default anchor point, plot size and picture frame size. Oddly HP does not reset the scaling parameters when the page size is changed. */ int scale_type = pcs->g.scaling_type; hpgl_scaling_params_t params = pcs->g.scaling_params; hpgl_default_coordinate_system(pcs); /* restore the scaling parameter. */ pcs->g.scaling_type = scale_type; pcs->g.scaling_params = params; hpgl_args_setup(&hpgl_args); hpgl_IW(&hpgl_args, pcs); hpgl_args_set_int(&hpgl_args, 0); hpgl_PM(&hpgl_args, pcs); hpgl_args_set_int(&hpgl_args, 2); hpgl_PM(&hpgl_args, pcs); hpgl_args_setup(&hpgl_args); hpgl_IP(&hpgl_args, pcs); } if ((type & pcl_reset_picture_frame) != 0) { /* this shouldn't happen. Picture frame side effects are handled directly by the command picture frame command. */ dmprintf(pcs->memory, "PCL reset picture frame received\n"); } if ((type & pcl_reset_overlay) != 0) /* ignore return */ (void)hpgl_reset_overlay(pcs); if ((type & (pcl_reset_plot_size)) != 0) { /* this shouldn't happen. Plot size side effects are handled directly by the command picture frame command. */ dmprintf(pcs->memory, "PCL reset plot received\n"); } if ((type & (pcl_reset_permanent)) != 0) { gx_path_free(&pcs->g.polygon.buffer.path, "hpgl_do_reset polygon buffer"); /* if we have allocated memory for a stick font free the memory */ hpgl_free_stick_fonts(pcs); } return; }