forked from OSGeo/grass
-
Notifications
You must be signed in to change notification settings - Fork 0
/
textbox.c
65 lines (52 loc) · 1.25 KB
/
textbox.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
/* Function: text_box_path
**
** Author: Paul W. Carlson March 1992
*/
#include "ps_info.h"
#define LEFT 0
#define RIGHT 1
#define LOWER 0
#define UPPER 1
#define CENTER 2
/* font name, size, and color must be set first, outside text_box_path()
* because text_box_path() is called repeatedly with identical
* font name, size, and color */
int text_box_path(double x, double y, int xref, int yref, char *text,
float rotate)
{
/* get relative box coordinates */
fprintf(PS.fp, "ZB (%s) PB\n", text);
/* set box x coordinate */
fprintf(PS.fp, "%.2f ", x);
/* set box y coordinate */
fprintf(PS.fp, " %.2f ", y);
fprintf(PS.fp, "translate %.2f rotate ", rotate);
fprintf(PS.fp, " 0 ");
switch (xref) {
case LEFT:
fprintf(PS.fp, "LTX");
break;
case RIGHT:
fprintf(PS.fp, "RTX");
break;
case CENTER:
default:
fprintf(PS.fp, "CTX");
break;
}
fprintf(PS.fp, " 0 ");
switch (yref) {
case UPPER:
fprintf(PS.fp, "UTY");
break;
case LOWER:
fprintf(PS.fp, "LTY");
break;
case CENTER:
default:
fprintf(PS.fp, "CTY");
break;
}
fprintf(PS.fp, " TR TB\n");
return 0;
}