Bug 691464 - PCLSelectFont (pxl) messes with pcl-ctm
Summary: PCLSelectFont (pxl) messes with pcl-ctm
Status: NOTIFIED FIXED
Alias: None
Product: GhostPCL
Classification: Unclassified
Component: PCL interpreter (show other bugs)
Version: master
Hardware: PC Windows XP
: P2 normal
Assignee: Henry Stiles
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-07-16 12:48 UTC by norbert.janssen
Modified: 2011-09-18 21:46 UTC (History)
0 users

See Also:
Customer: 661
Word Size: ---


Attachments
1 big A on a page (45 bytes, application/octet-stream)
2010-07-16 12:48 UTC, norbert.janssen
Details

Note You need to log in before you can comment on or make changes to this bug.
Description norbert.janssen 2010-07-16 12:48:59 UTC
Created attachment 6496 [details]
1 big A on a page

When printing attached testfiles (debugger attached with breakpoint at pcl_process):

ufst-obj/pcl6 -sDEVICE=jpeg -r600 -sOutputFile=page%d.jpg lprtest.pcl lprtest.pcl C706.xl lprtest.pcl

you see that the third lprtest.pcl prints no pages.
It looks like the PCLselectFont() is messing with the pcs->pgs->ctm

at start of second lprtest.pcl I had a breakpoint at pcl_process:
pcs->pgs->ctm = { 0.59, 0.0, -0.0, -0.59, 150.0, 6299.0, ... }

then the pcl_process is called from pxpcl_selectfont() with
pcs->pgs->ctm = { 0.08333, 0.0, 0.0, 0.08333, 142.0, 0.0, ... } to select the font.


finally when printing the last lprtest.pcl
pcl_process has:
pcs->pgs->ctm = { -59.05, 0.0, 0.0, -59.05, 481800.0, -2986.00 , ... }
which seems to be 100 times too big, thus not printing the big 'A' from lprtest.pcl.
Comment 1 norbert.janssen 2010-07-16 12:49:59 UTC
Created attachment 6497 [details]
xl job using PCLselectFont
Comment 2 norbert.janssen 2010-07-16 13:26:14 UTC
possible fix:

add a pcl_do_resets(global_pcs, pcl_reset_initial); to the pxpcl_release().
Comment 3 norbert.janssen 2010-07-16 14:52:28 UTC
(In reply to comment #2)
> possible fix:
> 
> add a pcl_do_resets(global_pcs, pcl_reset_initial); to the pxpcl_release().

it's not complete. It looks like the char_matrix is not reset.
I'm inclined to think that the pxpcl_release should also do more with
xfm_state (esp. lp2dev_mtx, pd2dev_mtx)

I see in the callstack:
pcl_process
 - pcl_text
  - pcl_set_graphics_state
   - pcl_set_ctm -> uses xfm_state.pd2dev_mtx which is still containing values from the PCLselectFont.
Comment 4 norbert.janssen 2010-07-20 09:33:19 UTC
(In reply to comment #3)
> (In reply to comment #2)
> > possible fix:
> > 
> > add a pcl_do_resets(global_pcs, pcl_reset_initial); to the pxpcl_release().
> 
> it's not complete. It looks like the char_matrix is not reset.
> I'm inclined to think that the pxpcl_release should also do more with
> xfm_state (esp. lp2dev_mtx, pd2dev_mtx)
> 
> I see in the callstack:
> pcl_process
>  - pcl_text
>   - pcl_set_graphics_state
>    - pcl_set_ctm -> uses xfm_state.pd2dev_mtx which is still containing values
> from the PCLselectFont.


Found it: the pxpcl_release() does not reset the pcs->end_page to pcl_end_page_top(). It spxpcl_release(void)
{
    if (global_pcs) {
        if (gs_debug_c('i'))
            dprintf("passthrough: releasing global pcl state\n");
        pcl_grestore(global_pcs);
        gs_grestore_only(global_pcs->pgs);
        gs_nulldevice(global_pcs->pgs);
        pcl_do_resets(global_pcs, pcl_reset_permanent);
	global_pcs->end_page = pcl_end_page_top;  /* pcl_end_page handling */
        pxpcl_pagestatereset();
        global_pcs = NULL; /* moved after pxpcl_pagestatereset(); */
        global_this_pass_contiguous = false;
        global_pass_first = true;
        global_char_shear.x = 0;
        global_char_shear.y = 0;
        global_char_scale.x = 1.0;
        global_char_scale.y = 1.0;
        global_char_bold_value = 0.0;
    }
}till is pcl_end_page_noop(), thus not printing any pages.
Comment 5 norbert.janssen 2010-07-20 09:44:05 UTC
(In reply to comment #4)
> (In reply to comment #3)
> > (In reply to comment #2)
> > > possible fix:
> > > 
> > > add a pcl_do_resets(global_pcs, pcl_reset_initial); to the pxpcl_release().
> > 
> > it's not complete. It looks like the char_matrix is not reset.
> > I'm inclined to think that the pxpcl_release should also do more with
> > xfm_state (esp. lp2dev_mtx, pd2dev_mtx)
> > 
> > I see in the callstack:
> > pcl_process
> >  - pcl_text
> >   - pcl_set_graphics_state
> >    - pcl_set_ctm -> uses xfm_state.pd2dev_mtx which is still containing values
> > from the PCLselectFont.
> 
> 
Found it: the pxpcl_release() does not reset the pcs->end_page to
pcl_end_page_top(). It still is pcl_end_page_noop(), thus not printing any pages (pcl is still in pclxl_snippet mode!).

pxpcl_release(void)
{
    if (global_pcs) {
         if (gs_debug_c('i'))
             dprintf("passthrough: releasing global pcl state\n");
         pcl_grestore(global_pcs);
         gs_grestore_only(global_pcs->pgs);
         gs_nulldevice(global_pcs->pgs);
         pcl_do_resets(global_pcs, pcl_reset_permanent);
         global_pcs->end_page = pcl_end_page_top;  /* pcl_end_page handling */
         pxpcl_pagestatereset();
         global_pcs = NULL; /* moved after pxpcl_pagestatereset(); */
         global_this_pass_contiguous = false;
         global_pass_first = true;
         global_char_shear.x = 0;
         global_char_shear.y = 0;
         global_char_scale.x = 1.0;
         global_char_scale.y = 1.0;
         global_char_bold_value = 0.0;
}
> }
Comment 6 Henry Stiles 2010-07-20 17:57:37 UTC
I can't reproduce this in my version of C706 but integrated your change see the log for 11530, reopen if there are other problems.
Comment 7 Marcos H. Woehrmann 2011-09-18 21:46:28 UTC
Changing customer bugs that have been resolved more than a year ago to closed.