add rotation angle to text output, currently used only by postscript,
ignored by all others
This commit is contained in:
parent
8ffc662b44
commit
56701e3d10
|
|
@ -247,9 +247,9 @@ DevDrawArc(int x0, int y0, int radius, double theta, double delta_theta)
|
|||
|
||||
|
||||
void
|
||||
DevDrawText(char *text, int x, int y)
|
||||
DevDrawText(char *text, int x, int y, int angle)
|
||||
{
|
||||
dispdev->DrawText (text, x, y);
|
||||
dispdev->DrawText (text, x, y, angle);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ void DevClose(void);
|
|||
void DevClear(void);
|
||||
void DevDrawLine(int x1, int y1, int x2, int y2);
|
||||
void DevDrawArc(int x0, int y0, int radius, double theta, double delta_theta);
|
||||
void DevDrawText(char *text, int x, int y);
|
||||
void DevDrawText(char *text, int x, int y, int angle);
|
||||
void DefineColor(int colorid, double red, double green, double blue);
|
||||
void DefineLinestyle(int linestyleid, int mask);
|
||||
void SetLinestyle(int linestyleid);
|
||||
|
|
|
|||
|
|
@ -243,9 +243,10 @@ GL_Arc(int x0, int y0, int r, double theta, double delta_theta)
|
|||
|
||||
|
||||
int
|
||||
GL_Text(char *text, int x, int y)
|
||||
GL_Text(char *text, int x, int y, int angle)
|
||||
{
|
||||
/* move to (x, y) */
|
||||
NG_IGNORE(angle);
|
||||
|
||||
fprintf(plotfile, "PU;PA %d , %d;", jgmult*(x+xoff+XTADJ), jgmult*(y+yoff+YTADJ));
|
||||
fprintf(plotfile, "LB %s \x03", text);
|
||||
|
|
|
|||
|
|
@ -276,7 +276,7 @@ gr_point(struct dvec *dv,
|
|||
for (; *tics < HUGE; tics++)
|
||||
if (*tics == (double) np) {
|
||||
DevDrawText("x", (int) (tox - currentgraph->fontwidth / 2),
|
||||
(int) (toy - currentgraph->fontheight / 2));
|
||||
(int) (toy - currentgraph->fontheight / 2), 0);
|
||||
/* gr_redraw will redraw this w/o our having to save it
|
||||
Guenther Roehrich 22-Jan-99 */
|
||||
/* SaveText(currentgraph, "x",
|
||||
|
|
@ -289,7 +289,7 @@ gr_point(struct dvec *dv,
|
|||
{
|
||||
/* Draw an 'x' */
|
||||
DevDrawText("x", (int) (tox - currentgraph->fontwidth / 2),
|
||||
(int) (toy - currentgraph->fontheight / 2));
|
||||
(int) (toy - currentgraph->fontheight / 2), 0);
|
||||
/* gr_redraw will redraw this w/o our having to save it
|
||||
Guenther Roehrich 22-Jan-99 */
|
||||
/* SaveText(currentgraph, "x",
|
||||
|
|
@ -308,7 +308,7 @@ gr_point(struct dvec *dv,
|
|||
pointc[0] = (char) dv->v_linestyle;
|
||||
pointc[1] = '\0';
|
||||
DevDrawText(pointc, (int) (tox - currentgraph->fontwidth / 2),
|
||||
(int) (toy - currentgraph->fontheight / 2));
|
||||
(int) (toy - currentgraph->fontheight / 2), 0);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
@ -415,14 +415,14 @@ drawlegend(GRAPH *graph, int plotno, struct dvec *dv)
|
|||
if (graph->plottype == PLOT_POINT) {
|
||||
(void) sprintf(buf, "%c : ", dv->v_linestyle);
|
||||
DevDrawText(buf, x + graph->viewport.width / 20
|
||||
- 3 * graph->fontwidth, y);
|
||||
- 3 * graph->fontwidth, y, 0);
|
||||
} else {
|
||||
SetLinestyle(dv->v_linestyle);
|
||||
DevDrawLine(x, i, x + graph->viewport.width / 20, i);
|
||||
}
|
||||
SetColor(1);
|
||||
DevDrawText(dv->v_name, x + graph->viewport.width / 20
|
||||
+ graph->fontwidth, y);
|
||||
+ graph->fontwidth, y, 0);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -452,7 +452,7 @@ gr_pmsg(char *text)
|
|||
DevDrawText(text, currentgraph->viewport.width -
|
||||
(int) (strlen(currentgraph->grid.xlabel) + 3) *
|
||||
currentgraph->fontwidth,
|
||||
currentgraph->absolute.height - currentgraph->fontheight);
|
||||
currentgraph->absolute.height - currentgraph->fontheight, 0);
|
||||
else
|
||||
fprintf(cp_err, " %s \n", text);
|
||||
|
||||
|
|
@ -581,7 +581,7 @@ gr_restoretext(GRAPH *graph)
|
|||
/* restore text */
|
||||
for (k = graph->keyed; k; k = k->next) {
|
||||
SetColor(k->colorindex);
|
||||
DevDrawText(k->text, k->x, k->y);
|
||||
DevDrawText(k->text, k->x, k->y, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -130,7 +130,7 @@ gr_redrawgrid(GRAPH *graph)
|
|||
if (graph->grid.xlabel) {
|
||||
DevDrawText(graph->grid.xlabel,
|
||||
(int) (graph->absolute.width * 0.35),
|
||||
graph->fontheight);
|
||||
graph->fontheight, 0);
|
||||
}
|
||||
if (graph->grid.ylabel) {
|
||||
if (graph->grid.gridtype == GRID_POLAR ||
|
||||
|
|
@ -139,14 +139,20 @@ gr_redrawgrid(GRAPH *graph)
|
|||
{
|
||||
DevDrawText(graph->grid.ylabel,
|
||||
graph->fontwidth,
|
||||
(graph->absolute.height * 3) / 4);
|
||||
(graph->absolute.height * 3) / 4, 0);
|
||||
} else {
|
||||
DevDrawText(graph->grid.ylabel,
|
||||
graph->fontwidth,
|
||||
graph->absolute.height / 2);
|
||||
graph->absolute.height / 2, 90);
|
||||
}
|
||||
}
|
||||
|
||||
/* draw postscript title */
|
||||
if (graph->plotname && eq(dispdev->name, "postscript"))
|
||||
DevDrawText(graph->plotname,
|
||||
graph->fontwidth,
|
||||
graph->absolute.height - graph->fontheight, 0);
|
||||
|
||||
switch (graph->grid.gridtype) {
|
||||
case GRID_POLAR:
|
||||
drawpolargrid(graph);
|
||||
|
|
@ -532,12 +538,12 @@ drawlingrid(GRAPH *graph, char *units, int spacing, int nsp, double dst, double
|
|||
if (axis == x_axis)
|
||||
DevDrawText(buf, graph->viewportxoff + i -
|
||||
((int) strlen(buf) * graph->fontwidth) / 2,
|
||||
(int) (graph->fontheight * 2.5));
|
||||
(int) (graph->fontheight * 2.5), 0);
|
||||
else
|
||||
DevDrawText(buf, graph->viewportxoff -
|
||||
graph->fontwidth * (int) strlen(buf),
|
||||
graph->viewportyoff + i -
|
||||
graph->fontheight / 2);
|
||||
graph->fontheight / 2, 0);
|
||||
|
||||
/* This is to make sure things work when delta > hi - lo. */
|
||||
if (nsp == 1)
|
||||
|
|
@ -545,10 +551,10 @@ drawlingrid(GRAPH *graph, char *units, int spacing, int nsp, double dst, double
|
|||
}
|
||||
if (axis == x_axis)
|
||||
DevDrawText(units, (int) (graph->absolute.width * 0.6),
|
||||
graph->fontheight);
|
||||
graph->fontheight, 0);
|
||||
else
|
||||
DevDrawText(units, graph->fontwidth,
|
||||
(int) (graph->absolute.height - 2 * graph->fontheight));
|
||||
(int) (graph->absolute.height - 2 * graph->fontheight), 0);
|
||||
DevUpdate();
|
||||
}
|
||||
|
||||
|
|
@ -705,12 +711,12 @@ drawloggrid(GRAPH *graph, char *units, int hmt, int lmt, int decsp, int subs, in
|
|||
if (axis == x_axis)
|
||||
DevDrawText(buf, graph->viewportxoff + i -
|
||||
((int) strlen(buf) * graph->fontwidth) / 2,
|
||||
(int) (graph->fontheight * 2.5));
|
||||
(int) (graph->fontheight * 2.5), 0);
|
||||
else
|
||||
DevDrawText(buf, graph->viewportxoff - graph->fontwidth *
|
||||
(int) (strlen(buf) + 1),
|
||||
graph->viewportyoff + i -
|
||||
graph->fontheight / 2);
|
||||
graph->fontheight / 2, 0);
|
||||
|
||||
if (j >= hmt)
|
||||
break;
|
||||
|
|
@ -742,10 +748,10 @@ drawloggrid(GRAPH *graph, char *units, int hmt, int lmt, int decsp, int subs, in
|
|||
|
||||
if (axis == x_axis)
|
||||
DevDrawText(units, (int) (graph->absolute.width * 0.6),
|
||||
graph->fontheight);
|
||||
graph->fontheight, 0);
|
||||
else
|
||||
DevDrawText(units, graph->fontwidth,
|
||||
(int) (graph->absolute.height - 2 * graph->fontheight));
|
||||
(int) (graph->absolute.height - 2 * graph->fontheight), 0);
|
||||
|
||||
DevUpdate();
|
||||
}
|
||||
|
|
@ -969,7 +975,7 @@ drawpolargrid(GRAPH *graph)
|
|||
DevDrawText(buf, graph->grid.xaxis.circular.center
|
||||
+ graph->grid.xaxis.circular.radius,
|
||||
graph->grid.yaxis.circular.center
|
||||
- graph->grid.xaxis.circular.radius);
|
||||
- graph->grid.xaxis.circular.radius, 0);
|
||||
DevUpdate();
|
||||
}
|
||||
|
||||
|
|
@ -1001,9 +1007,9 @@ adddeglabel(GRAPH *graph, int deg, int x, int y, int cx, int cy, int lx, int ly)
|
|||
x = (int)(x + d * cos(angle) - w / 2);
|
||||
y = (int)(y + d * sin(angle) - h / 2);
|
||||
|
||||
DevDrawText(buf, x, y);
|
||||
DevDrawText(buf, x, y, 0);
|
||||
DevDrawText("o", x + (int) strlen(buf) * graph->fontwidth,
|
||||
y + graph->fontheight / 2);
|
||||
y + graph->fontheight / 2, 0);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1025,7 +1031,7 @@ addradlabel(GRAPH *graph, int lab, double theta, int x, int y)
|
|||
} else {
|
||||
x -= graph->fontwidth * (int) strlen(buf) + 3;
|
||||
}
|
||||
DevDrawText(buf, x, y);
|
||||
DevDrawText(buf, x, y, 0);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1297,16 +1303,16 @@ drawsmithgrid(GRAPH *graph)
|
|||
DevDrawLine(gr_xcenter - zheight, gr_ycenter + yoff,
|
||||
gr_xcenter + zheight, gr_ycenter + yoff);
|
||||
DevDrawText("0", gr_xcenter + zheight + gi_fntwidth, gr_ycenter + yoff -
|
||||
gi_fntheight / 2);
|
||||
DevDrawText("o", gr_xcenter + zheight + gi_fntwidth * 2, gr_ycenter + yoff);
|
||||
gi_fntheight / 2, 0);
|
||||
DevDrawText("o", gr_xcenter + zheight + gi_fntwidth * 2, gr_ycenter + yoff, 0);
|
||||
DevDrawText("180", gr_xcenter - zheight - gi_fntwidth * 5, gr_ycenter
|
||||
+ yoff - gi_fntheight / 2);
|
||||
DevDrawText("o", gr_xcenter - zheight - gi_fntwidth * 2, gr_ycenter + yoff);
|
||||
+ yoff - gi_fntheight / 2, 0);
|
||||
DevDrawText("o", gr_xcenter - zheight - gi_fntwidth * 2, gr_ycenter + yoff, 0);
|
||||
}
|
||||
|
||||
/* (void) sprintf(buf, "e%d", basemag); */
|
||||
(void) sprintf(buf, "e%d", 0);
|
||||
DevDrawText(buf, gr_xcenter + gr_radius, gr_ycenter - gr_radius);
|
||||
DevDrawText(buf, gr_xcenter + gr_radius, gr_ycenter - gr_radius, 0);
|
||||
|
||||
DevUpdate();
|
||||
}
|
||||
|
|
@ -1389,15 +1395,15 @@ arcset(GRAPH *graph, double rad, double prevrad, double irad, double iprevrad, d
|
|||
gi_fntwidth * (int) strlen(plab) - 2;
|
||||
if ((x > pxmin) && (x < pxmax)) {
|
||||
if ((yoffset > - gr_radius) && (yoffset < gr_radius))
|
||||
DevDrawText(plab, x, centy + yoffset - gi_fntheight - 1);
|
||||
DevDrawText(plab, x, centy + yoffset - gi_fntheight - 1, 0);
|
||||
else
|
||||
DevDrawText(plab, x, gr_ymargin - 3 * gi_fntheight - 2);
|
||||
DevDrawText(plab, x, gr_ymargin - 3 * gi_fntheight - 2, 0);
|
||||
}
|
||||
/*
|
||||
* x = centx + xoffset + (int) radoff + 2 * (int)rad -
|
||||
* gi_fntwidth * strlen(nlab) - 2;
|
||||
* if ((x > gr_xmargin) && (x < gi_maxx))
|
||||
* DevDrawText(nlab, x, centy + yoffset - gi_fntheight - 1);
|
||||
* DevDrawText(nlab, x, centy + yoffset - gi_fntheight - 1, 0);
|
||||
*/
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -170,9 +170,10 @@ Plt5_Arc(int xc, int yc, int radius, double theta, double delta_theta)
|
|||
|
||||
|
||||
int
|
||||
Plt5_Text(char *text, int x, int y)
|
||||
Plt5_Text(char *text, int x, int y, int angle)
|
||||
{
|
||||
int savedlstyle;
|
||||
NG_IGNORE(angle);
|
||||
|
||||
/* set linestyle to solid
|
||||
or may get funny color text on some plotters */
|
||||
|
|
|
|||
|
|
@ -287,7 +287,7 @@ handlekeypressed(Widget w, XtPointer client_data, XEvent *ev, Boolean *continue_
|
|||
PushGraphContext(graph);
|
||||
text[nbytes] = '\0';
|
||||
SetColor(1);
|
||||
DevDrawText(text, keyev->x, graph->absolute.height - keyev->y);
|
||||
DevDrawText(text, keyev->x, graph->absolute.height - keyev->y, 0);
|
||||
/* save it */
|
||||
SaveText(graph, text, keyev->x, graph->absolute.height - keyev->y);
|
||||
/* warp mouse so user can type in sequence */
|
||||
|
|
@ -549,10 +549,11 @@ X11_Arc(int x0, int y0, int radius, double theta, double delta_theta)
|
|||
|
||||
/* note: x and y are the LOWER left corner of text */
|
||||
int
|
||||
X11_Text(char *text, int x, int y)
|
||||
X11_Text(char *text, int x, int y, int angle)
|
||||
{
|
||||
/* We specify text position by lower left corner, so have to adjust for
|
||||
X11's font nonsense. */
|
||||
NG_IGNORE(angle);
|
||||
|
||||
if (DEVDEP(currentgraph).isopen)
|
||||
XDrawString(display, DEVDEP(currentgraph).window,
|
||||
|
|
|
|||
|
|
@ -217,6 +217,7 @@ PS_NewViewport(GRAPH *graph)
|
|||
fprintf(plotfile, "} def\n");
|
||||
fprintf(plotfile, "/%s /%sLatin1 ISOLatin1Encoding ReEncode\n", psfont, psfont);
|
||||
|
||||
fprintf(plotfile, "%g %g scale\n", 1.0 / scale, 1.0 / scale);
|
||||
if (colorflag == 1) {
|
||||
/* set the background to color given in spinit (or 0) */
|
||||
PS_SelectColor(setbgcolor);
|
||||
|
|
@ -325,7 +326,7 @@ PS_Arc(int x0, int y0, int r, double theta, double delta_theta)
|
|||
|
||||
|
||||
int
|
||||
PS_Text(char *text, int x, int y)
|
||||
PS_Text(char *text, int x, int y, int angle)
|
||||
{
|
||||
int savedlstyle, savedcolor;
|
||||
|
||||
|
|
@ -347,7 +348,11 @@ PS_Text(char *text, int x, int y)
|
|||
PS_Stroke();
|
||||
/* move to (x, y) */
|
||||
fprintf(plotfile, "%d %d moveto\n", x + xoff + xtadj, y + yoff + ytadj);
|
||||
/* rotate the text counterclockwise by 'angle' degrees */
|
||||
fprintf(plotfile, "%d rotate\n", angle);
|
||||
fprintf(plotfile, "(%s) show\n", text);
|
||||
/* rotate the text back clockwise by 'angle' degrees */
|
||||
fprintf(plotfile, "-%d rotate\n", angle);
|
||||
|
||||
DEVDEP(currentgraph).lastx = -1;
|
||||
DEVDEP(currentgraph).lasty = -1;
|
||||
|
|
|
|||
|
|
@ -859,11 +859,12 @@ WIN_Text_old(char *text, int x, int y, int degrees)
|
|||
|
||||
|
||||
int
|
||||
WIN_Text(char *text, int x, int y)
|
||||
WIN_Text(char *text, int x, int y, int angle)
|
||||
{
|
||||
tpWindowData wd;
|
||||
HFONT hfont;
|
||||
LOGFONT lf;
|
||||
NG_IGNORE(angle);
|
||||
|
||||
int CentiDegrees = 0;
|
||||
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ typedef int disp_fn_Close_t (void);
|
|||
typedef int disp_fn_Clear_t (void);
|
||||
typedef int disp_fn_DrawLine_t (int x1, int y1, int x2, int y2);
|
||||
typedef int disp_fn_Arc_t (int x0, int y0, int radius, double theta, double delta_theta);
|
||||
typedef int disp_fn_Text_t (char *text, int x, int y);
|
||||
typedef int disp_fn_Text_t (char *text, int x, int y, int angle);
|
||||
typedef int disp_fn_DefineColor_t (int colorid, double red, double green, double blue);
|
||||
typedef int disp_fn_DefineLinestyle_t (int linestyleid, int mask);
|
||||
typedef int disp_fn_SetLinestyle_t (int linestyleid);
|
||||
|
|
|
|||
|
|
@ -188,7 +188,7 @@ int sp_Tk_SetColor(int colorid);
|
|||
int sp_Tk_SetLinestyle(int linestyleid);
|
||||
int sp_Tk_DefineLinestyle(int linestyleid, int mask);
|
||||
int sp_Tk_DefineColor(int colorid, double red, double green, double blue);
|
||||
int sp_Tk_Text(char *text, int x, int y);
|
||||
int sp_Tk_Text(char *text, int x, int y, int angle);
|
||||
int sp_Tk_Arc(int x0, int y0, int radius, double theta, double delta_theta);
|
||||
int sp_Tk_DrawLine(int x1, int y1, int x2, int y2);
|
||||
int sp_Tk_Clear(void);
|
||||
|
|
@ -1631,9 +1631,10 @@ sp_Tk_Arc(int x0, int y0, int radius, double theta, double delta_theta)
|
|||
|
||||
|
||||
int
|
||||
sp_Tk_Text(char *text, int x, int y)
|
||||
sp_Tk_Text(char *text, int x, int y, int angle)
|
||||
{
|
||||
char buf[1024];
|
||||
NG_IGNORE(angle);
|
||||
sprintf(buf, "spice_gr_Text \"%s\" %i %i", text, x, y);
|
||||
if (Tcl_Eval(spice_interp, buf) != TCL_OK) {
|
||||
Tcl_ResetResult(spice_interp);
|
||||
|
|
|
|||
Loading…
Reference in New Issue