Esempio n. 1
0
static void PsText(Justify just,double x,double y,int font,char *str)
{
  fprintf(outfp, "HE%d setfont\n", font);
  switch(just) {
  case JustifyLeft:
    fprintf(outfp, "%f %f moveto\n", x, y);
    fputc('(', outfp);
    EscapePrint(str);
    fprintf(outfp, ")\n");
    fprintf(outfp, "show\n");
    break;
  case JustifyCenter:
    fputc('(', outfp);
    EscapePrint(str);
    fprintf(outfp, ")\n");
    fprintf(outfp, "dup stringwidth pop\n");
    fprintf(outfp, "2 div\n");
    fprintf(outfp, "%f\n", x);
    fprintf(outfp, "exch sub\n");
    fprintf(outfp, "%f moveto\n", y);
    fprintf(outfp, "show\n");
    break;
  case JustifyRight:
    fputc('(', outfp);
    EscapePrint(str);
    fprintf(outfp, ")\n");
    fprintf(outfp, "dup stringwidth pop\n");
    fprintf(outfp, "%f\n", x);
    fprintf(outfp, "exch sub\n");
    fprintf(outfp, "%f moveto\n", y);
    fprintf(outfp, "show\n");
    break;
  case JustifyVertical:
    fprintf(outfp, "gsave\n");
    fputc('(', outfp);
    EscapePrint(str);
    fprintf(outfp, ")\n");
    fprintf(outfp, "dup stringwidth pop\n");
    fprintf(outfp, "%f\n", y);
    fprintf(outfp, "exch sub\n");
    fprintf(outfp, "%f exch\n", x);
    fprintf(outfp, "translate\n");
    fprintf(outfp, "90 rotate\n");
    fprintf(outfp, "0 0 moveto\n");
    fprintf(outfp, "show\n");
    fprintf(outfp, "grestore\n");
  }
}
Esempio n. 2
0
static void
TitleText(void)
{
    floatish x, y;
 
    x = borderspace + titletextspace;
    y = borderheight - titleheight - borderspace + titletextspace;
 
    /* job identifier goes at far left */
 
    fprintf(psfp, "HE%d setfont\n", TITLE_TEXT_FONT);
    fprintf(psfp, "%f %f moveto\n", x, y);
    fputc('(', psfp); 
    EscapePrint(jobstring, SMALL_JOB_STRING_WIDTH);
    fprintf(psfp, ") show\n");
 
    /* area below curve is centered */
 
    fprintf(psfp, "HE%d setfont\n", TITLE_TEXT_FONT);
    fputc('(', psfp);
    CommaPrint(psfp, (intish) areabelow);
    fprintf(psfp, " %s x %s)\n", valueunitstring, sampleunitstring);
 
    fprintf(psfp, "dup stringwidth pop\n");
    fprintf(psfp, "2 div\n");
    fprintf(psfp, "%f\n", titlewidth / 2);
    fprintf(psfp, "exch sub\n");
    fprintf(psfp, "%f moveto\n", y);
    fprintf(psfp, "show\n");
 
    /* date goes at far right */
 
    fprintf(psfp, "HE%d setfont\n", TITLE_TEXT_FONT);
    fprintf(psfp, "(%s)\n", datestring);
    fprintf(psfp, "dup stringwidth pop\n");
    fprintf(psfp, "%f\n", (titlewidth + borderspace) - titletextspace);
    fprintf(psfp, "exch sub\n");
    fprintf(psfp, "%f moveto\n", y);
    fprintf(psfp, "show\n");
}