Exemple #1
0
/*
 * ESC & l <line> E
 *
 * Set top margin. This will also reset the page length.
 */
  static int
set_top_margin(
    pcl_args_t *    pargs,
    pcl_state_t *   pcs
)
{
    coord           hgt = pcs->xfm_state.pd_size.y;
    coord           tmarg = uint_arg(pargs) * pcs->vmi_cp;

    if ((pcs->vmi_cp != 0) && (tmarg <= hgt)) {
        bool was_default = (pcs->margins.top == TOP_MARGIN(hgt, DFLT_TOP_MARGIN) &&
                            pcs->margins.left == DFLT_LEFT_MARGIN);

        pcs->margins.top = tmarg;
        pcs->margins.length = PAGE_LENGTH(hgt - tmarg, DFLT_BOTTOM_MARGIN);

        /* If the cursor has been moved then we have a fixed cap and the
           top margin only affects the next page. If the cap is floating,
           unmarked and unmoved, then the cap moves to the first line of text.
           More restrictive than implementor's guide:
           iff a default margin is changed on an unmarked unmoved page to the new margin.
           margin_set(A) ^L margin_set(B)  --> use (A)
           escE margin_set(B) --> use (B)
         */
        if (was_default && pcl_page_marked(pcs) == 0 )
            return pcl_set_cap_y(pcs, 0L, false, false, true, false);
    }
    return 0;
}
Exemple #2
0
/*
 * Reset the top margin an text length.
 *
 * Note that, even though changing the print direction merely relabels (but does
 * not relocate) the margins, the preint direction does change the location of
 * the default margins.
 */
static void
reset_vertical_margins(pcl_state_t * pcs, bool for_passthrough)
{
    pcl_margins_t *pmar = &(pcs->margins);
    coord hgt = pcs->xfm_state.pd_size.y;
    coord tm = (for_passthrough ?
                DFLT_TOP_MARGIN_PASSTHROUGH : DFLT_TOP_MARGIN);
    coord bm = (for_passthrough ?
                DFLT_BOTOM_MARGIN_PASSTHROUGH : DFLT_BOTTOM_MARGIN);
    pmar->top = TOP_MARGIN(hgt, tm);
    pmar->length = PAGE_LENGTH(hgt - pmar->top, bm);
}
Exemple #3
0
/*
 * ESC & l <line> E
 *
 * Set top margin. This will also reset the page length.
 */
static int
set_top_margin(pcl_args_t * pargs, pcl_state_t * pcs)
{
    coord hgt = pcs->xfm_state.pd_size.y;
    coord tmarg = uint_arg(pargs) * pcs->vmi_cp;

    if ((pcs->vmi_cp != 0) && (tmarg <= hgt)) {
        pcs->margins.top = tmarg;
        pcs->margins.length = PAGE_LENGTH(hgt - tmarg, DFLT_BOTTOM_MARGIN);
        /* See the discussion in the Implementor's guide concerning
           "fixed" and "floating" cap.  If the page is not dirty we
           home the cursor - the guide talks about tracking the cursor
           for any movement and checking for data on the page */
        if (!pcl_page_marked(pcs) && !pcl_cursor_moved(pcs))
            return pcl_set_cap_y(pcs, 0L, false, false, true, false);
    }
    return 0;
}