/* If PJL FORMLINES is set use we always use that value to derive VMI, otherwise we use the HP documented default. This may not be exactly what HP does, the state interaction between formlines, paper size, orientation each of which can have different values in PJL and PCL is quite difficult to figure out, we believe this is correct for the vast majority of cases. */ coord pcl_vmi_default(pcl_state_t * pcs) { coord vmi; if (!pjl_proc_compare(pcs->pjls, pjl_proc_get_envvar(pcs->pjls, "FORMLINES_SET"), "ON")) { vmi = (pcs->margins.length / pjl_proc_vartoi(pcs->pjls, pjl_proc_get_envvar(pcs->pjls, "formlines"))); } else { vmi = inch2coord(8.0 / 48.0); } return vmi; }
/* PS; NB this is only a partial implementation. */ int hpgl_PS(hpgl_args_t *pargs, hpgl_state_t *pgls) { hpgl_real_t page_dims[2]; /* we use the pcl paper handling machinery to set the plot size */ pcl_paper_size_t paper; int i; if ( pgls->personality != rtl ) return 0; /* PS return an error if the page is dirty */ if ( pcl_page_marked(pgls) ) return e_Range; /* check for pjl override of the arguments - this is custom code for a customer and is not the normal interaction between PCL & PJL */ if (!pjl_proc_compare(pgls->pjls, pjl_proc_get_envvar(pgls->pjls, "plotsizeoverride"), "on")) { page_dims[0] = pjl_proc_vartof(pgls->pjls, pjl_proc_get_envvar(pgls->pjls, "plotsize1")); page_dims[1] = pjl_proc_vartof(pgls->pjls, pjl_proc_get_envvar(pgls->pjls, "plotsize2")); } else { for ( i = 0; i < 2 && hpgl_arg_real(pgls->memory, pargs, &page_dims[i]); ++i ) ; /* NOTHING */ if ( i == 1 ) page_dims[1] = page_dims[0]; else if ( i != 2 ) return e_Range; } paper.height = plu_2_coord(page_dims[0]); paper.width = plu_2_coord(page_dims[1]); paper.offset_portrait = 0; paper.offset_landscape = 0; new_logical_page(pgls, 0, &paper, false, false); return 0; }
/* * End a page, either unconditionally or only if there are marks on it. * Return 1 if the page was actually printed and erased. */ int pcl_end_page( pcl_state_t * pcs, pcl_print_condition_t condition ) { int code = 0; pcl_break_underline(pcs); /* (could mark page) */ /* If we are conditionally printing (normal case) check if the page is marked */ if (condition != pcl_print_always) { if ( !pcl_page_marked(pcs) ) return 0; } /* If there's an overlay macro, execute it now. */ if (pcs->overlay_enabled) { void * value; if ( pl_dict_find( &pcs->macros, id_key(pcs->overlay_macro_id), 2, &value ) ) { pcs->overlay_enabled = false; /**** IN reset_overlay ****/ code = pcl_execute_macro( (const pcl_macro_t *)value, pcs, pcl_copy_before_overlay, pcl_reset_overlay, pcl_copy_after_overlay ); pcs->overlay_enabled = true; /**** IN copy_after ****/ } } /* output the page */ code = (*pcs->end_page)(pcs, pcs->num_copies, true); if ( code < 0 ) return code; /* allow the logical orientation command to be used again */ pcs->orientation_set = false; if ( pcs->end_page == pcl_end_page_top ) code = gs_erasepage(pcs->pgs); pcs->page_marked = false; /* force new logical page, allows external resolution changes. * see -dFirstPage -dLastPage * NB would be faster if we didn't do this every page. * * NB setting a new logical page defaults settings * that should carry over from the previous page * this error occurs only on documents that don't do any initilizations per page * hence only the viewer applications will see the speedup and the error */ if (!pjl_proc_compare(pcs->pjls, pjl_proc_get_envvar(pcs->pjls, "viewer"), "on")) { new_logical_page(pcs, pcs->xfm_state.lp_orient, pcs->xfm_state.paper_size, false, false); } /* * Advance of a page may move from a page front to a page back. This may * change the applicable transformations. */ update_xfm_state(pcs, 0); pcl_continue_underline(pcs); return (code < 0 ? code : 1); }