Пример #1
0
/*
 * ESC & a <col> M
 *
 * Set right margin. The right margin is set to the *right* edge of the
 * specified column, so we need to add 1 to the column number.
 */
static int
set_right_margin(pcl_args_t * pargs, pcl_state_t * pcs)
{
    coord rmarg = (uint_arg(pargs) + 1) * pcl_hmi(pcs);

    if (rmarg > pcs->xfm_state.pd_size.x)
        rmarg = pcs->xfm_state.pd_size.x;
    if (rmarg > pcs->margins.left) {
        pcs->margins.right = rmarg;
        if (pcs->cap.x > rmarg)
            pcl_set_cap_x(pcs, rmarg, false, false);
    }

    return 0;
}
Пример #2
0
/*
 * HT
 *
 * Tabs occur at ever 8 columns, measure from the left text margin.
 */
static int
cmd_HT(pcl_args_t * pargs,      /* ignored */
       pcl_state_t * pcs)
{
    coord x = pcs->cap.x - pcs->margins.left;
    coord tab;

    if (x < 0)
        x = -x;
    else if ((tab = 8 * pcl_hmi(pcs)) > 0)
        x = tab - (x % tab);
    else
        x = 0L;
    pcl_set_cap_x(pcs, x, true, true);
    pcs->cursor_moved = true;
    return 0;
}
Пример #3
0
/*
 * ESC & a <col> L
 *
 * Set left margin.
 */
static int
set_left_margin(pcl_args_t * pargs, pcl_state_t * pcs)
{
    coord lmarg = uint_arg(pargs) * pcl_hmi(pcs);

    /* adjust underlining if the left margin passes to the right of
       the underline start position */
    if ((pcs->underline_enabled) && (lmarg > pcs->underline_start.x))
        pcs->underline_start.x = lmarg;

    if (lmarg < pcs->margins.right) {
        pcs->margins.left = lmarg;
        if (pcs->cap.x < lmarg)
            pcl_set_cap_x(pcs, lmarg, false, false);
    }
    return 0;
}
Пример #4
0
/*
 * ESC & a <cols> C
 */
static int
horiz_cursor_pos_columns(pcl_args_t * pargs, pcl_state_t * pcs)
{
    do_horiz_motion(pargs, pcs, pcl_hmi(pcs), false);
    return 0;
}