/* Defines a "standard" viewport with seven character heights for   */
/* the left margin and four character heights everywhere else       */

#include "plplot.h"

void plvsta()
{
    double xmin, xmax, ymin, ymax;
    double chrdef, chrht, spdxmi, spdxma, spdymi, spdyma;
    int level;

    glev(&level);
    if (level < 1) plexit("Please call plstar before calling plvsta.");

    gchr(&chrdef,&chrht);
    gspd(&spdxmi,&spdxma,&spdymi,&spdyma);

/*  Find out position of subpage boundaries in millimetres, reduce by */
/*  the desired border, and convert back into normalized subpage */
/*  coordinates */

    xmin = dcscx(mmdcx((double)(dcmmx(spdxmi) + 8 * chrht)));
    xmax = dcscx(mmdcx((double)(dcmmx(spdxma) - 5 * chrht)));
    ymin = dcscy(mmdcy((double)(dcmmy(spdymi) + 5 * chrht)));
    ymax = dcscy(mmdcy((double)(dcmmy(spdyma) - 5 * chrht)));

    plvpor(xmin,xmax,ymin,ymax);
}
