The R Project SVN R

Rev

Rev 19598 | Rev 19876 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 19598 Rev 19875
Line 32... Line 32...
32
#include <Graphics.h>
32
#include <Graphics.h>
33
 
33
 
34
 
34
 
35
/* The R graphics device */
35
/* The R graphics device */
36
 
36
 
-
 
37
/* These are a bit unthreadable aren't they?
-
 
38
 * Better to pass them all down, but that's a heck of a lot of 
-
 
39
 * changes to make to the function call argument lists!!
-
 
40
 */
37
static DevDesc *MathDevice;
41
static GEDevDesc *MathDevice;
38
static unsigned int BoxColor;
42
static unsigned int BoxColor;
39
static unsigned int TextColor;
43
static unsigned int TextColor;
-
 
44
/* The value of cex passed into GEMathText
-
 
45
 */
40
static double BaseCex = 1;
46
static double BaseCex = 1;
-
 
47
static double MathGamma;
-
 
48
/* The value of font passed into GEMathText
-
 
49
 * May be modified by plotmath code -- it is plotmath code's 
-
 
50
 * responsibility to save and restore temporary changes.
-
 
51
 */
-
 
52
static int MathFont;
-
 
53
/* A temporary value of cex that may be modified by plotmath code.
-
 
54
 */
-
 
55
static double MathCex;
-
 
56
static double MathPs;
41
static GUnit MetricUnit = INCHES;
57
static GEUnit MetricUnit = GE_INCHES;
42
 
58
 
43
/* Font Definitions */
59
/* Font Definitions */
44
 
60
 
45
typedef enum {
61
typedef enum {
46
    PlainFont	   = 1,
62
    PlainFont	   = 1,
Line 69... Line 85...
69
static double CurrentY;
85
static double CurrentY;
70
static double CurrentAngle;
86
static double CurrentAngle;
71
static double CosAngle;
87
static double CosAngle;
72
static double SinAngle;
88
static double SinAngle;
73
 
89
 
74
 
-
 
75
/* Convert CurrentX and CurrentY from */
90
/* Convert CurrentX and CurrentY from */
76
/* 0 angle to and CurrentAngle */
91
/* 0 angle to and CurrentAngle */
77
 
92
 
78
static double ConvertedX()
93
static double ConvertedX()
79
{
94
{
80
    double rotatedX = ReferenceX +
95
    double rotatedX = ReferenceX +
81
	(CurrentX - ReferenceX) * CosAngle -
96
	(CurrentX - ReferenceX) * CosAngle -
82
	(CurrentY - ReferenceY) * SinAngle;
97
	(CurrentY - ReferenceY) * SinAngle;
83
    return rotatedX;
98
    return toDeviceX(rotatedX, MetricUnit, MathDevice);
84
}
99
}
85
 
100
 
86
static double ConvertedY()
101
static double ConvertedY()
87
{
102
{
88
    double rotatedY = ReferenceY +
103
    double rotatedY = ReferenceY +
89
	(CurrentY - ReferenceY) * CosAngle +
104
	(CurrentY - ReferenceY) * CosAngle +
90
	(CurrentX - ReferenceX) * SinAngle;
105
	(CurrentX - ReferenceX) * SinAngle;
91
    return rotatedY;
106
    return toDeviceY(rotatedY, MetricUnit, MathDevice);
92
}
107
}
93
 
108
 
94
static void PMoveAcross(double xamount)
109
static void PMoveAcross(double xamount)
95
{
110
{
96
    CurrentX += xamount;
111
    CurrentX += xamount;
Line 111... Line 126...
111
 
126
 
112
#ifdef OLD
127
#ifdef OLD
113
static double FontHeight()
128
static double FontHeight()
114
{
129
{
115
    double height, depth, width;
130
    double height, depth, width;
-
 
131
    GEMetricInfo(0, 
-
 
132
		MathFont, MathCex, MathPs,
116
    GMetricInfo(0, &height, &depth, &width, MetricUnit, MathDevice);
133
		&height, &depth, &width, MathDevice);
117
    return height + depth;
134
    return fromDeviceHeight(height + depth, MetricUnit, MathDevice);
118
}
135
}
119
#endif
136
#endif
120
 
137
 
121
static double xHeight()
138
static double xHeight()
122
{
139
{
123
    double height, depth, width;
140
    double height, depth, width;
-
 
141
    GEMetricInfo('x', 
-
 
142
		MathFont, MathCex, MathPs,
124
    GMetricInfo('x', &height, &depth, &width, MetricUnit, MathDevice);
143
		&height, &depth, &width, MathDevice);
125
    return height;
144
    return fromDeviceHeight(height, MetricUnit, MathDevice);
126
}
145
}
127
 
146
 
128
static double XHeight()
147
static double XHeight()
129
{
148
{
130
    double height, depth, width;
149
    double height, depth, width;
-
 
150
    GEMetricInfo('X', 
-
 
151
		MathFont, MathCex, MathPs,
131
    GMetricInfo('X', &height, &depth, &width, MetricUnit, MathDevice);
152
		&height, &depth, &width, MathDevice);
132
    return height;
153
    return fromDeviceHeight(height, MetricUnit, MathDevice);
133
}
154
}
134
 
155
 
135
static double AxisHeight()
156
static double AxisHeight()
136
{
157
{
137
    double height, depth, width;
158
    double height, depth, width;
-
 
159
    GEMetricInfo('+', 
-
 
160
		MathFont, MathCex, MathPs,
138
    GMetricInfo('+', &height, &depth, &width, MetricUnit, MathDevice);
161
		&height, &depth, &width, MathDevice);
139
    return 0.5 * height;
162
    return fromDeviceHeight(0.5 * height, MetricUnit, MathDevice);
140
}
163
}
141
 
164
 
142
static double Quad()
165
static double Quad()
143
{
166
{
144
    double height, depth, width;
167
    double height, depth, width;
-
 
168
    GEMetricInfo('M', 
-
 
169
		MathFont, MathCex, MathPs,
145
    GMetricInfo('M', &height, &depth, &width, MetricUnit, MathDevice);
170
		&height, &depth, &width, MathDevice);
146
    return width;
171
    return fromDeviceHeight(width, MetricUnit, MathDevice);
147
}
172
}
148
 
173
 
149
/* The height of digits */
174
/* The height of digits */
150
static double FigHeight()
175
static double FigHeight()
151
{
176
{
152
    double height, depth, width;
177
    double height, depth, width;
-
 
178
    GEMetricInfo('0', 
-
 
179
		MathFont, MathCex, MathPs,
153
    GMetricInfo('0', &height, &depth, &width, MetricUnit, MathDevice);
180
		&height, &depth, &width, MathDevice);
154
    return height;
181
    return fromDeviceHeight(height, MetricUnit, MathDevice);
155
}
182
}
156
 
183
 
157
/* Depth of lower case descenders */
184
/* Depth of lower case descenders */
158
static double DescDepth()
185
static double DescDepth()
159
{
186
{
160
    double height, depth, width;
187
    double height, depth, width;
-
 
188
    GEMetricInfo('g', 
-
 
189
		MathFont, MathCex, MathPs,
161
    GMetricInfo('g', &height, &depth, &width, MetricUnit, MathDevice);
190
		&height, &depth, &width, MathDevice);
162
    return depth;
191
    return fromDeviceHeight(depth, MetricUnit, MathDevice);
163
}
192
}
164
 
193
 
165
#ifdef NOT_used_currently/*-- out 'def'	 (-Wall) --*/
194
#ifdef NOT_used_currently/*-- out 'def'	 (-Wall) --*/
166
static double AscHeight()
195
static double AscHeight()
167
{
196
{
168
    double height, depth, width, save;
197
    double height, depth, width, save;
-
 
198
    GEMetricInfo('d', 
-
 
199
		MathFont, MathCex, MathPs,
169
    GMetricInfo('d', &height, &depth, &width, MetricUnit, MathDevice);
200
		&height, &depth, &width, MathDevice);
170
    save = height;
201
    save = height;
-
 
202
    GEMetricInfo('a', 
-
 
203
		MathFont, MathCex, MathPs,
171
    GMetricInfo('a', &height, &depth, &width, MetricUnit, MathDevice);
204
		&height, &depth, &width, MathDevice);
172
    return save - height;
205
    return fromDeviceHeight(save - height, MetricUnit, MathDevice);
173
}
206
}
174
#endif
207
#endif
175
/* Thickness of rules */
208
/* Thickness of rules */
176
static double RuleThickness()
209
static double RuleThickness()
177
{
210
{
Line 180... Line 213...
180
 
213
 
181
static double ThinSpace()
214
static double ThinSpace()
182
{
215
{
183
    double height, depth, width;
216
    double height, depth, width;
184
    static double OneSixth = 0.16666666666666666666;
217
    static double OneSixth = 0.16666666666666666666;
-
 
218
    GEMetricInfo('M', 
-
 
219
		MathFont, MathCex, MathPs,
185
    GMetricInfo('M', &height, &depth, &width, MetricUnit, MathDevice);
220
		&height, &depth, &width, MathDevice);
186
    return OneSixth * width;
221
    return fromDeviceHeight(OneSixth * width, MetricUnit, MathDevice);
187
}
222
}
188
 
223
 
189
static double MediumSpace()
224
static double MediumSpace()
190
{
225
{
191
    double height, depth, width;
226
    double height, depth, width;
192
    static double TwoNinths = 0.22222222222222222222;
227
    static double TwoNinths = 0.22222222222222222222;
-
 
228
    GEMetricInfo('M', 
-
 
229
		MathFont, MathCex, MathPs,
193
    GMetricInfo('M', &height, &depth, &width, MetricUnit, MathDevice);
230
		&height, &depth, &width, MathDevice);
194
    return TwoNinths * width;
231
    return fromDeviceHeight(TwoNinths * width, MetricUnit, MathDevice);
195
}
232
}
196
 
233
 
197
static double ThickSpace()
234
static double ThickSpace()
198
{
235
{
199
    double height, depth, width;
236
    double height, depth, width;
200
    static double FiveEighteenths = 0.27777777777777777777;
237
    static double FiveEighteenths = 0.27777777777777777777;
-
 
238
    GEMetricInfo('M', 
-
 
239
		MathFont, MathCex, MathPs,
201
    GMetricInfo('M', &height, &depth, &width, MetricUnit, MathDevice);
240
		&height, &depth, &width, MathDevice);
202
    return FiveEighteenths * width;
241
    return fromDeviceHeight(FiveEighteenths * width, MetricUnit, MathDevice);
203
}
242
}
204
 
243
 
205
static double MuSpace()
244
static double MuSpace()
206
{
245
{
207
    double height, depth, width;
246
    double height, depth, width;
208
    static double OneEighteenth = 0.05555555555555555555;
247
    static double OneEighteenth = 0.05555555555555555555;
-
 
248
    GEMetricInfo('M', 
-
 
249
		MathFont, MathCex, MathPs,
209
    GMetricInfo('M', &height, &depth, &width, MetricUnit, MathDevice);
250
		&height, &depth, &width, MathDevice);
210
    return OneEighteenth * width;
251
    return fromDeviceHeight(OneEighteenth * width, MetricUnit, MathDevice);
211
}
252
}
212
 
253
 
213
 
254
 
214
/*
255
/*
215
 *  Mathematics Layout Parameters
256
 *  Mathematics Layout Parameters
Line 336... Line 377...
336
    switch (newstyle) {
377
    switch (newstyle) {
337
    case STYLE_D:
378
    case STYLE_D:
338
    case STYLE_T:
379
    case STYLE_T:
339
    case STYLE_D1:
380
    case STYLE_D1:
340
    case STYLE_T1:
381
    case STYLE_T1:
341
	Rf_gpptr(MathDevice)->cex = 1.0 * BaseCex;
382
	MathCex = 1.0 * BaseCex;
342
	break;
383
	break;
343
    case STYLE_S:
384
    case STYLE_S:
344
    case STYLE_S1:
385
    case STYLE_S1:
345
	Rf_gpptr(MathDevice)->cex = 0.7 * BaseCex;
386
	MathCex = 0.7 * BaseCex;
346
	break;
387
	break;
347
    case STYLE_SS:
388
    case STYLE_SS:
348
    case STYLE_SS1:
389
    case STYLE_SS1:
349
	Rf_gpptr(MathDevice)->cex = 0.5 * BaseCex;
390
	MathCex = 0.5 * BaseCex;
350
	break;
391
	break;
351
    default:
392
    default:
352
	error("invalid math style encountered");
393
	error("invalid math style encountered");
353
    }
394
    }
354
    CurrentStyle = newstyle;
395
    CurrentStyle = newstyle;
Line 570... Line 611...
570
    double xsaved = CurrentX;
611
    double xsaved = CurrentX;
571
    double ysaved = CurrentY;
612
    double ysaved = CurrentY;
572
    double x[5], y[5];
613
    double x[5], y[5];
573
    CurrentX += xoffset;
614
    CurrentX += xoffset;
574
    CurrentY += yoffset;
615
    CurrentY += yoffset;
575
    Rf_gpptr(MathDevice)->col = BoxColor;
-
 
576
    PMoveUp(-bboxDepth(bbox));
616
    PMoveUp(-bboxDepth(bbox));
577
    x[4] = x[0] = ConvertedX();
617
    x[4] = x[0] = ConvertedX();
578
    y[4] = y[0] = ConvertedY();
618
    y[4] = y[0] = ConvertedY();
579
    PMoveAcross(bboxWidth(bbox));
619
    PMoveAcross(bboxWidth(bbox));
580
    x[1] = ConvertedX();
620
    x[1] = ConvertedX();
Line 583... Line 623...
583
    x[2] = ConvertedX();
623
    x[2] = ConvertedX();
584
    y[2] = ConvertedY();
624
    y[2] = ConvertedY();
585
    PMoveAcross(-bboxWidth(bbox));
625
    PMoveAcross(-bboxWidth(bbox));
586
    x[3] = ConvertedX();
626
    x[3] = ConvertedX();
587
    y[3] = ConvertedY();
627
    y[3] = ConvertedY();
588
    GPolyline(5, x, y, INCHES, MathDevice);
628
    GEPolyline(5, x, y, BoxColor, MathGamma, LTY_SOLID, 1, INCHES, MathDevice);
589
    PMoveTo(xsaved, ysaved);
629
    PMoveTo(xsaved, ysaved);
590
    Rf_gpptr(MathDevice)->col = TextColor;
-
 
591
    return bbox;
630
    return bbox;
592
}
631
}
593
#endif
632
#endif
594
 
633
 
595
typedef struct {
634
typedef struct {
Line 912... Line 951...
912
#ifdef NOT_used_currently/*-- out 'def'	 (-Wall) --*/
951
#ifdef NOT_used_currently/*-- out 'def'	 (-Wall) --*/
913
static FontType CurrentFont = 3;
952
static FontType CurrentFont = 3;
914
#endif
953
#endif
915
static FontType GetFont()
954
static FontType GetFont()
916
{
955
{
917
    return Rf_gpptr(MathDevice)->font;
956
    return MathFont;
918
}
957
}
919
 
958
 
920
static FontType SetFont(FontType font)
959
static FontType SetFont(FontType font)
921
{
960
{
922
    FontType prevfont = Rf_gpptr(MathDevice)->font;
961
    FontType prevfont = MathFont;
923
    Rf_gpptr(MathDevice)->font = font;
962
    MathFont = font;
924
    return prevfont;
963
    return prevfont;
925
}
964
}
926
 
965
 
927
static int UsingItalics()
966
static int UsingItalics()
928
{
967
{
929
    return (Rf_gpptr(MathDevice)->font == ItalicFont ||
968
    return (MathFont == ItalicFont ||
930
	    Rf_gpptr(MathDevice)->font == BoldItalicFont);
969
	    MathFont == BoldItalicFont);
931
}
970
}
932
 
971
 
933
static BBOX GlyphBBox(int chr)
972
static BBOX GlyphBBox(int chr)
934
{
973
{
935
    BBOX bbox;
974
    BBOX bbox;
936
    double height, depth, width;
975
    double height, depth, width;
-
 
976
    GEMetricInfo(chr, 
-
 
977
		MathFont, MathCex, MathPs,
937
    GMetricInfo(chr, &height, &depth, &width, MetricUnit, MathDevice);
978
		&height, &depth, &width, MathDevice);
938
    bboxHeight(bbox) = height;
979
    bboxHeight(bbox) = fromDeviceHeight(height, MetricUnit, MathDevice);
939
    bboxDepth(bbox)  = depth;
980
    bboxDepth(bbox)  = fromDeviceHeight(depth, MetricUnit, MathDevice);
940
    bboxWidth(bbox)  = width;
981
    bboxWidth(bbox)  = fromDeviceHeight(width, MetricUnit, MathDevice);
941
    bboxItalic(bbox) = 0;
982
    bboxItalic(bbox) = 0;
942
    bboxSimple(bbox) = 1;
983
    bboxSimple(bbox) = 1;
943
    return bbox;
984
    return bbox;
944
}
985
}
945
 
986
 
Line 982... Line 1023...
982
	prev = SetFont(SymbolFont);
1023
	prev = SetFont(SymbolFont);
983
    bbox = GlyphBBox(ascii);
1024
    bbox = GlyphBBox(ascii);
984
    if (draw) {
1025
    if (draw) {
985
	asciiStr[0] = ascii;
1026
	asciiStr[0] = ascii;
986
	asciiStr[1] = '\0';
1027
	asciiStr[1] = '\0';
987
	GText(ConvertedX(), ConvertedY(), INCHES, asciiStr,
1028
	GEText(ConvertedX(), ConvertedY(), asciiStr, 
988
	      0.0, 0.0, CurrentAngle, MathDevice);
1029
	      0.0, 0.0, CurrentAngle, 
-
 
1030
	      TextColor, MathGamma, MathFont, MathCex, MathPs,
-
 
1031
	      MathDevice);
989
	PMoveAcross(bboxWidth(bbox));
1032
	PMoveAcross(bboxWidth(bbox));
990
    }
1033
    }
991
    SetFont(prev);
1034
    SetFont(prev);
992
    return bbox;
1035
    return bbox;
993
}
1036
}
Line 1022... Line 1065...
1022
	    else
1065
	    else
1023
		bboxItalic(glyphBBox) = 0;
1066
		bboxItalic(glyphBBox) = 0;
1024
	    if (draw) {
1067
	    if (draw) {
1025
		chr[0] = *s;
1068
		chr[0] = *s;
1026
		PMoveAcross(lastItalicCorr);
1069
		PMoveAcross(lastItalicCorr);
1027
		GText(ConvertedX(), ConvertedY(), INCHES, chr,
1070
		GEText(ConvertedX(), ConvertedY(), chr,
1028
		      0.0, 0.0, CurrentAngle, MathDevice);
1071
		      0.0, 0.0, CurrentAngle, 
-
 
1072
		      TextColor, MathGamma, MathFont, MathCex, MathPs,
-
 
1073
		      MathDevice);
1029
		PMoveAcross(bboxWidth(glyphBBox));
1074
		PMoveAcross(bboxWidth(glyphBBox));
1030
	    }
1075
	    }
1031
	    bboxWidth(resultBBox) += lastItalicCorr;
1076
	    bboxWidth(resultBBox) += lastItalicCorr;
1032
	    resultBBox = CombineBBoxes(resultBBox, glyphBBox);
1077
	    resultBBox = CombineBBoxes(resultBBox, glyphBBox);
1033
	    lastItalicCorr = bboxItalic(glyphBBox);
1078
	    lastItalicCorr = bboxItalic(glyphBBox);
Line 1048... Line 1093...
1048
    char asciiStr[2];
1093
    char asciiStr[2];
1049
    bbox = GlyphBBox(ascii);
1094
    bbox = GlyphBBox(ascii);
1050
    if (draw) {
1095
    if (draw) {
1051
	asciiStr[0] = ascii;
1096
	asciiStr[0] = ascii;
1052
	asciiStr[1] = '\0';
1097
	asciiStr[1] = '\0';
1053
	GText(ConvertedX(), ConvertedY(), INCHES, asciiStr,
1098
	GEText(ConvertedX(), ConvertedY(), asciiStr,
1054
	      0.0, 0.0, CurrentAngle, MathDevice);
1099
	      0.0, 0.0, CurrentAngle, 
-
 
1100
	      TextColor, MathGamma, MathFont, MathCex, MathPs,
-
 
1101
	      MathDevice);
1055
	PMoveAcross(bboxWidth(bbox));
1102
	PMoveAcross(bboxWidth(bbox));
1056
    }
1103
    }
1057
    return bbox;
1104
    return bbox;
1058
}
1105
}
1059
 
1106
 
Line 1067... Line 1114...
1067
	    glyphBBox = GlyphBBox(*s);
1114
	    glyphBBox = GlyphBBox(*s);
1068
	    resultBBox = CombineBBoxes(resultBBox, glyphBBox);
1115
	    resultBBox = CombineBBoxes(resultBBox, glyphBBox);
1069
	    s++;
1116
	    s++;
1070
	}
1117
	}
1071
	if (draw) {
1118
	if (draw) {
1072
	    GText(ConvertedX(), ConvertedY(), INCHES, str,
1119
	    GEText(ConvertedX(), ConvertedY(), str,
1073
		  0.0, 0.0, CurrentAngle, MathDevice);
1120
		  0.0, 0.0, CurrentAngle, 
-
 
1121
		  TextColor, MathGamma, MathFont, MathCex, MathPs,
-
 
1122
		  MathDevice);
1074
	    PMoveAcross(bboxWidth(resultBBox));
1123
	    PMoveAcross(bboxWidth(resultBBox));
1075
	}
1124
	}
1076
	if (UsingItalics())
1125
	if (UsingItalics())
1077
	    bboxItalic(resultBBox) = ItalicFactor * bboxHeight(glyphBBox);
1126
	    bboxItalic(resultBBox) = ItalicFactor * bboxHeight(glyphBBox);
1078
	else
1127
	else
Line 1246... Line 1295...
1246
    /* The Default Font Character */
1295
    /* The Default Font Character */
1247
    return RenderSymbolChar(S_SLASH, draw);
1296
    return RenderSymbolChar(S_SLASH, draw);
1248
#endif
1297
#endif
1249
#ifdef SLASH1
1298
#ifdef SLASH1
1250
    /* Symbol Magnify Version */
1299
    /* Symbol Magnify Version */
1251
    double savecex = Rf_gpptr(MathDevice)->cex;
1300
    double savecex = MathCex;
1252
    BBOX bbox;
1301
    BBOX bbox;
1253
    double height1, height2;
1302
    double height1, height2;
1254
    height1 = bboxHeight(RenderSymbolChar(S_SLASH, 0));
1303
    height1 = bboxHeight(RenderSymbolChar(S_SLASH, 0));
1255
    Rf_gpptr(MathDevice)->cex = 1.2 * Rf_gpptr(MathDevice)->cex;
1304
    MathCex = 1.2 * MathCex;
1256
    height2 = bboxHeight(RenderSymbolChar(S_SLASH, 0));
1305
    height2 = bboxHeight(RenderSymbolChar(S_SLASH, 0));
1257
    if (draw)
1306
    if (draw)
1258
	PMoveUp(- 0.5 * (height2 - height1));
1307
	PMoveUp(- 0.5 * (height2 - height1));
1259
    bbox = RenderSymbolChar(S_SLASH, draw);
1308
    bbox = RenderSymbolChar(S_SLASH, draw);
1260
    if (draw)
1309
    if (draw)
1261
	PMoveUp(0.5 * (height2 - height1));
1310
	PMoveUp(0.5 * (height2 - height1));
1262
    Rf_gpptr(MathDevice)->cex = savecex;
1311
    MathCex = savecex;
1263
    return bbox;
1312
    return bbox;
1264
#endif
1313
#endif
1265
#ifdef SLASH2
1314
#ifdef SLASH2
1266
    /* Line Drawing Version */
1315
    /* Line Drawing Version */
1267
    double x[2], y[2];
1316
    double x[2], y[2];
Line 1276... Line 1325...
1276
	PMoveAcross(width);
1325
	PMoveAcross(width);
1277
	PMoveUp(depth + height);
1326
	PMoveUp(depth + height);
1278
	x[1] = ConvertedX();
1327
	x[1] = ConvertedX();
1279
	y[1] = ConvertedY();
1328
	y[1] = ConvertedY();
1280
	PMoveUp(-height);
1329
	PMoveUp(-height);
-
 
1330
	GEPolyline(2, x, y,
1281
	GPolyline(2, x, y, INCHES, MathDevice);
1331
		  TextColor, MathGamma, LTY_SOLID, 1, MathDevice);
1282
	PMoveAcross(0.5 * width);
1332
	PMoveAcross(0.5 * width);
1283
    }
1333
    }
1284
    return MakeBBox(height, depth, 2 * width);
1334
    return MakeBBox(height, depth, 2 * width);
1285
#endif
1335
#endif
1286
#ifdef SLASH3
1336
#ifdef SLASH3
Line 1519... Line 1569...
1519
	    y[i + 1] = ConvertedY();
1569
	    y[i + 1] = ConvertedY();
1520
	}
1570
	}
1521
	PMoveTo(baseX + totalwidth, baseY + hatHeight);
1571
	PMoveTo(baseX + totalwidth, baseY + hatHeight);
1522
	x[NTILDE + 2] = ConvertedX();
1572
	x[NTILDE + 2] = ConvertedX();
1523
	y[NTILDE + 2] = ConvertedY();
1573
	y[NTILDE + 2] = ConvertedY();
1524
	GPolyline(NTILDE + 3, x, y, INCHES, MathDevice);
1574
	GEPolyline(NTILDE + 3, x, y, 
-
 
1575
		  TextColor, MathGamma, LTY_SOLID, 1, MathDevice);
1525
	PMoveTo(savedX + totalwidth, savedY);
1576
	PMoveTo(savedX + totalwidth, savedY);
1526
    }
1577
    }
1527
    return MakeBBox(height + accentGap + hatHeight,
1578
    return MakeBBox(height + accentGap + hatHeight,
1528
		    bboxDepth(bbox), totalwidth);
1579
		    bboxDepth(bbox), totalwidth);
1529
}
1580
}
Line 1555... Line 1606...
1555
	y[1] = ConvertedY();
1606
	y[1] = ConvertedY();
1556
	PMoveAcross(0.5 * totalwidth);
1607
	PMoveAcross(0.5 * totalwidth);
1557
	PMoveUp(-hatHeight);
1608
	PMoveUp(-hatHeight);
1558
	x[2] = ConvertedX();
1609
	x[2] = ConvertedX();
1559
	y[2] = ConvertedY();
1610
	y[2] = ConvertedY();
1560
	GPolyline(3, x, y, INCHES, MathDevice);
1611
	GEPolyline(3, x, y, 
-
 
1612
		  TextColor, MathGamma, LTY_SOLID, 1, MathDevice);
1561
	PMoveTo(savedX + width, savedY);
1613
	PMoveTo(savedX + width, savedY);
1562
    }
1614
    }
1563
    return EnlargeBBox(bbox, accentGap + hatHeight, 0, 0);
1615
    return EnlargeBBox(bbox, accentGap + hatHeight, 0, 0);
1564
}
1616
}
1565
 
1617
 
Line 1585... Line 1637...
1585
	x[0] = ConvertedX();
1637
	x[0] = ConvertedX();
1586
	y[0] = ConvertedY();
1638
	y[0] = ConvertedY();
1587
	PMoveAcross(width);
1639
	PMoveAcross(width);
1588
	x[1] = ConvertedX();
1640
	x[1] = ConvertedX();
1589
	y[1] = ConvertedY();
1641
	y[1] = ConvertedY();
1590
	GPolyline(2, x, y, INCHES, MathDevice);
1642
	GEPolyline(2, x, y, 
-
 
1643
		  TextColor, MathGamma, LTY_SOLID, 1, MathDevice);
1591
	PMoveTo(savedX + width, savedY);
1644
	PMoveTo(savedX + width, savedY);
1592
    }
1645
    }
1593
    return EnlargeBBox(bbox, accentGap, 0, 0);
1646
    return EnlargeBBox(bbox, accentGap, 0, 0);
1594
}
1647
}
1595
 
1648
 
Line 1759... Line 1812...
1759
	    x[0] = ConvertedX();
1812
	    x[0] = ConvertedX();
1760
	    y[0] = ConvertedY();
1813
	    y[0] = ConvertedY();
1761
	    PMoveAcross(width);
1814
	    PMoveAcross(width);
1762
	    x[1] = ConvertedX();
1815
	    x[1] = ConvertedX();
1763
	    y[1] = ConvertedY();
1816
	    y[1] = ConvertedY();
1764
	    GPolyline(2, x, y, INCHES, MathDevice);
1817
	    GEPolyline(2, x, y, 
-
 
1818
		  TextColor, MathGamma, LTY_SOLID, 1, MathDevice);
1765
	    PMoveUp(-AxisHeight());
1819
	    PMoveUp(-AxisHeight());
1766
	}
1820
	}
1767
	PMoveTo(savedX + width, savedY);
1821
	PMoveTo(savedX + width, savedY);
1768
    }
1822
    }
1769
    return CombineAlignedBBoxes(numBBox, denomBBox);
1823
    return CombineAlignedBBoxes(numBBox, denomBBox);
Line 1841... Line 1895...
1841
}
1895
}
1842
 
1896
 
1843
static BBOX RenderDelimiter(int delim, int draw)
1897
static BBOX RenderDelimiter(int delim, int draw)
1844
{
1898
{
1845
    BBOX bbox;
1899
    BBOX bbox;
1846
    double savecex = Rf_gpptr(MathDevice)->cex;
1900
    double savecex = MathCex;
1847
    Rf_gpptr(MathDevice)->cex = DelimSymbolMag * Rf_gpptr(MathDevice)->cex;
1901
    MathCex = DelimSymbolMag * MathCex;
1848
    bbox = RenderSymbolChar(delim, draw);
1902
    bbox = RenderSymbolChar(delim, draw);
1849
    Rf_gpptr(MathDevice)->cex = savecex;
1903
    MathCex = savecex;
1850
    return bbox;
1904
    return bbox;
1851
}
1905
}
1852
 
1906
 
1853
static int GroupAtom(SEXP expr)
1907
static int GroupAtom(SEXP expr)
1854
{
1908
{
1855
    return NameAtom(expr) && NameMatch(expr, "group");
1909
    return NameAtom(expr) && NameMatch(expr, "group");
1856
}
1910
}
1857
 
1911
 
1858
static BBOX RenderGroup(SEXP expr, int draw)
1912
static BBOX RenderGroup(SEXP expr, int draw)
1859
{
1913
{
1860
    double cexSaved = Rf_gpptr(MathDevice)->cex;
1914
    double cexSaved = MathCex;
1861
    BBOX bbox;
1915
    BBOX bbox;
1862
    int code;
1916
    int code;
1863
    if (length(expr) != 4)
1917
    if (length(expr) != 4)
1864
	errorcall(expr, "invalid group specification");
1918
	errorcall(expr, "invalid group specification");
1865
    bbox = NullBBox();
1919
    bbox = NullBBox();
1866
    code = DelimCode(expr, CADR(expr));
1920
    code = DelimCode(expr, CADR(expr));
1867
    Rf_gpptr(MathDevice)->cex = DelimSymbolMag * Rf_gpptr(MathDevice)->cex;
1921
    MathCex = DelimSymbolMag * MathCex;
1868
    if (code == 2) {
1922
    if (code == 2) {
1869
	bbox = RenderSymbolChar('|', draw);
1923
	bbox = RenderSymbolChar('|', draw);
1870
	bbox = RenderSymbolChar('|', draw);
1924
	bbox = RenderSymbolChar('|', draw);
1871
    }
1925
    }
1872
    else if (code != '.')
1926
    else if (code != '.')
1873
	bbox = RenderSymbolChar(code, draw);
1927
	bbox = RenderSymbolChar(code, draw);
1874
    Rf_gpptr(MathDevice)->cex = cexSaved;
1928
    MathCex = cexSaved;
1875
    bbox = CombineBBoxes(bbox, RenderElement(CADDR(expr), draw));
1929
    bbox = CombineBBoxes(bbox, RenderElement(CADDR(expr), draw));
1876
    bbox = RenderItalicCorr(bbox, draw);
1930
    bbox = RenderItalicCorr(bbox, draw);
1877
    code = DelimCode(expr, CADDDR(expr));
1931
    code = DelimCode(expr, CADDDR(expr));
1878
    Rf_gpptr(MathDevice)->cex = DelimSymbolMag * Rf_gpptr(MathDevice)->cex;
1932
    MathCex = DelimSymbolMag * MathCex;
1879
    if (code == 2) {
1933
    if (code == 2) {
1880
	bbox = CombineBBoxes(bbox, RenderSymbolChar('|', draw));
1934
	bbox = CombineBBoxes(bbox, RenderSymbolChar('|', draw));
1881
	bbox = CombineBBoxes(bbox, RenderSymbolChar('|', draw));
1935
	bbox = CombineBBoxes(bbox, RenderSymbolChar('|', draw));
1882
    }
1936
    }
1883
    else if (code != '.')
1937
    else if (code != '.')
1884
	bbox = CombineBBoxes(bbox, RenderSymbolChar(code, draw));
1938
	bbox = CombineBBoxes(bbox, RenderSymbolChar(code, draw));
1885
    Rf_gpptr(MathDevice)->cex = cexSaved;
1939
    MathCex = cexSaved;
1886
    return bbox;
1940
    return bbox;
1887
}
1941
}
1888
 
1942
 
1889
static int BGroupAtom(SEXP expr)
1943
static int BGroupAtom(SEXP expr)
1890
{
1944
{
Line 2152... Line 2206...
2152
}
2206
}
2153
 
2207
 
2154
static BBOX RenderOpSymbol(SEXP op, int draw)
2208
static BBOX RenderOpSymbol(SEXP op, int draw)
2155
{
2209
{
2156
    BBOX bbox;
2210
    BBOX bbox;
2157
    double cexSaved = Rf_gpptr(MathDevice)->cex;
2211
    double cexSaved = MathCex;
2158
    /*double savedX = CurrentX;*/
2212
    /*double savedX = CurrentX;*/
2159
    /*double savedY = CurrentY;*/
2213
    /*double savedY = CurrentY;*/
2160
    double shift;
2214
    double shift;
2161
    int display = (GetStyle() > STYLE_T);
2215
    int display = (GetStyle() > STYLE_T);
2162
    int opId = OpAtom(op);
2216
    int opId = OpAtom(op);
2163
 
2217
 
2164
    if (opId == S_SUM || opId == S_PRODUCT ||
2218
    if (opId == S_SUM || opId == S_PRODUCT ||
2165
	opId == S_UNION || opId == S_INTERSECTION) {
2219
	opId == S_UNION || opId == S_INTERSECTION) {
2166
	if (display) {
2220
	if (display) {
2167
	    Rf_gpptr(MathDevice)->cex = OperatorSymbolMag * Rf_gpptr(MathDevice)->cex;
2221
	    MathCex = OperatorSymbolMag * MathCex;
2168
	    bbox = RenderSymbolChar(OpAtom(op), 0);
2222
	    bbox = RenderSymbolChar(OpAtom(op), 0);
2169
	    shift = 0.5 * (bboxHeight(bbox) - bboxDepth(bbox)) - TeX(sigma22);
2223
	    shift = 0.5 * (bboxHeight(bbox) - bboxDepth(bbox)) - TeX(sigma22);
2170
	    if (draw) {
2224
	    if (draw) {
2171
		PMoveUp(-shift);
2225
		PMoveUp(-shift);
2172
		bbox = RenderSymbolChar(opId, 1);
2226
		bbox = RenderSymbolChar(opId, 1);
2173
		PMoveUp(shift);
2227
		PMoveUp(shift);
2174
	    }
2228
	    }
2175
	    Rf_gpptr(MathDevice)->cex = cexSaved;
2229
	    MathCex = cexSaved;
2176
	    return ShiftBBox(bbox, -shift);
2230
	    return ShiftBBox(bbox, -shift);
2177
	}
2231
	}
2178
	else return RenderSymbolChar(opId, draw);
2232
	else return RenderSymbolChar(opId, draw);
2179
    }
2233
    }
2180
    else {
2234
    else {
Line 2337... Line 2391...
2337
	x[3] = ConvertedX();
2391
	x[3] = ConvertedX();
2338
	y[3] = ConvertedY();
2392
	y[3] = ConvertedY();
2339
	PMoveAcross(radSpace + bboxWidth(bodyBBox) + radTrail);
2393
	PMoveAcross(radSpace + bboxWidth(bodyBBox) + radTrail);
2340
	x[4] = ConvertedX();
2394
	x[4] = ConvertedX();
2341
	y[4] = ConvertedY();
2395
	y[4] = ConvertedY();
2342
	GPolyline(5, x, y, INCHES, MathDevice);
2396
	GEPolyline(5, x, y, 
-
 
2397
		  TextColor, MathGamma, LTY_SOLID, 1, MathDevice);
2343
	PMoveTo(savedX, savedY);
2398
	PMoveTo(savedX, savedY);
2344
    }
2399
    }
2345
    orderBBox = CombineAlignedBBoxes(orderBBox,
2400
    orderBBox = CombineAlignedBBoxes(orderBBox,
2346
				     RenderGap(leadWidth + radSpace, draw));
2401
				     RenderGap(leadWidth + radSpace, draw));
2347
    SetPrimeStyle(style);
2402
    SetPrimeStyle(style);
Line 2376... Line 2431...
2376
	x[0] = ConvertedX();
2431
	x[0] = ConvertedX();
2377
	y[0] = ConvertedY();
2432
	y[0] = ConvertedY();
2378
	PMoveUp(depth + height);
2433
	PMoveUp(depth + height);
2379
	x[1] = ConvertedX();
2434
	x[1] = ConvertedX();
2380
	y[1] = ConvertedY();
2435
	y[1] = ConvertedY();
2381
	GPolyline(2, x, y, INCHES, MathDevice);
2436
	GEPolyline(2, x, y, 
-
 
2437
		  TextColor, MathGamma, LTY_SOLID, 1, MathDevice);
2382
	PMoveUp(-height);
2438
	PMoveUp(-height);
2383
    }
2439
    }
2384
    bbox = CombineBBoxes(bbox, RenderGap(MuSpace(), draw));
2440
    bbox = CombineBBoxes(bbox, RenderGap(MuSpace(), draw));
2385
    bbox = CombineBBoxes(bbox, RenderElement(CADR(expr), draw));
2441
    bbox = CombineBBoxes(bbox, RenderElement(CADR(expr), draw));
2386
    bbox = RenderItalicCorr(bbox, draw);
2442
    bbox = RenderItalicCorr(bbox, draw);
Line 2390... Line 2446...
2390
	x[0] = ConvertedX();
2446
	x[0] = ConvertedX();
2391
	y[0] = ConvertedY();
2447
	y[0] = ConvertedY();
2392
	PMoveUp(depth + height);
2448
	PMoveUp(depth + height);
2393
	x[1] = ConvertedX();
2449
	x[1] = ConvertedX();
2394
	y[1] = ConvertedY();
2450
	y[1] = ConvertedY();
2395
	GPolyline(2, x, y, INCHES, MathDevice);
2451
	GEPolyline(2, x, y, 
-
 
2452
		  TextColor, MathGamma, LTY_SOLID, 1, MathDevice);
2396
	PMoveUp(-height);
2453
	PMoveUp(-height);
2397
    }
2454
    }
2398
    bbox = CombineBBoxes(bbox, RenderGap(MuSpace(), draw));
2455
    bbox = CombineBBoxes(bbox, RenderGap(MuSpace(), draw));
2399
    return bbox;
2456
    return bbox;
2400
}
2457
}
Line 2826... Line 2883...
2826
    CurrentY = savedY;
2883
    CurrentY = savedY;
2827
    return bbox;
2884
    return bbox;
2828
 
2885
 
2829
}
2886
}
2830
 
2887
 
-
 
2888
/* Functions forming the R API */
-
 
2889
 
2831
/* Calculate width of expression */
2890
/* Calculate width of expression */
2832
/* BBOXes are in INCHES (see MetricUnit) */
2891
/* BBOXes are in INCHES (see MetricUnit) */
2833
 
2892
 
2834
/* #ifdef'ed this function out to shut -Wall up */
-
 
2835
#ifdef OLD
-
 
2836
static
-
 
2837
void GExpressionBBox(SEXP expr, GUnit units, double *width,
2893
double GEExpressionWidth(SEXP expr, 
2838
		     double *height, double *depth, DevDesc *dd)
2894
			 int font, double cex, double ps,
2839
{
-
 
2840
    BBOX bbox;
-
 
2841
    MathDevice = dd;
2895
			 GEDevDesc *dd)
2842
/* The following two lines don't look right to me, but I inserted them
-
 
2843
   because otherwise you get trouble if you calculate BBoxes without
-
 
2844
   plotting any math first... Similar problem in the next two functions
-
 
2845
	 --pd */
-
 
2846
    CurrentStyle = STYLE_D;
-
 
2847
    SetFont(PlainFont);
-
 
2848
    bbox = RenderElement(expr, 0);
-
 
2849
    *width  = bboxWidth(bbox);
-
 
2850
    *height  = bboxHeight(bbox);
-
 
2851
    *depth  = bboxDepth(bbox);
-
 
2852
    if (units != INCHES) {
-
 
2853
	*width = GConvertXUnits(*width, INCHES, units, dd);
-
 
2854
	*height = GConvertYUnits(*height, INCHES, units, dd);
-
 
2855
	*depth = GConvertYUnits(*depth, INCHES, units, dd);
-
 
2856
    }
-
 
2857
}
-
 
2858
#endif
-
 
2859
 
-
 
2860
double GExpressionWidth(SEXP expr, GUnit units, DevDesc *dd)
-
 
2861
{
2896
{
2862
    BBOX bbox;
2897
    BBOX bbox;
2863
    double width;
2898
    double width;
2864
    MathDevice = dd;
2899
    MathDevice = dd;
-
 
2900
    BaseCex = cex;
-
 
2901
    MathFont = font;
-
 
2902
    MathCex = cex;
-
 
2903
    MathPs = ps;
2865
    CurrentStyle = STYLE_D;
2904
    CurrentStyle = STYLE_D;
2866
    SetFont(PlainFont);
2905
    SetFont(PlainFont);
2867
    bbox = RenderElement(expr, 0);
2906
    bbox = RenderElement(expr, 0);
2868
    width  = bboxWidth(bbox);
2907
    width  = bboxWidth(bbox);
2869
    if (units == INCHES)
-
 
2870
	return width;
-
 
2871
    else
-
 
2872
	return GConvertXUnits(width, INCHES, units, dd);
2908
    return toDeviceWidth(width, GE_INCHES, dd);
2873
}
2909
}
2874
 
2910
 
2875
double GExpressionHeight(SEXP expr, GUnit units, DevDesc *dd)
2911
double GEExpressionHeight(SEXP expr, 
-
 
2912
			  int font, double cex, double ps,
-
 
2913
			  GEDevDesc *dd)
2876
{
2914
{
2877
    BBOX bbox;
2915
    BBOX bbox;
2878
    double height;
2916
    double height;
2879
    MathDevice = dd;
2917
    MathDevice = dd;
-
 
2918
    BaseCex = cex;
-
 
2919
    MathFont = font;
-
 
2920
    MathCex = cex;
-
 
2921
    MathPs = ps;
2880
    CurrentStyle = STYLE_D;
2922
    CurrentStyle = STYLE_D;
2881
    SetFont(PlainFont);
2923
    SetFont(PlainFont);
2882
    bbox = RenderElement(expr, 0);
2924
    bbox = RenderElement(expr, 0);
2883
    height = bboxHeight(bbox) + bboxDepth(bbox);
2925
    height = bboxHeight(bbox) + bboxDepth(bbox);
2884
    if (units == INCHES)
-
 
2885
	return height;
-
 
2886
    else
-
 
2887
	return GConvertYUnits(height, INCHES, units, dd);
2926
    return toDeviceHeight(height, GE_INCHES, dd);
2888
}
2927
}
2889
 
2928
 
2890
/* Functions forming the R API */
-
 
2891
 
-
 
2892
void GMathText(double x, double y, int coords, SEXP expr,
2929
void GEMathText(double x, double y, SEXP expr,
2893
	       double xc, double yc, double rot, DevDesc *dd)
2930
		double xc, double yc, double rot, 
-
 
2931
		int col, double gamma, int font, double cex, double ps,
-
 
2932
		GEDevDesc *dd)
2894
{
2933
{
2895
    BBOX bbox;
2934
    BBOX bbox;
2896
 
2935
 
2897
#ifdef BUG61
2936
#ifdef BUG61
2898
#else
2937
#else
2899
    /* IF font metric information is not available for device */
2938
    /* IF font metric information is not available for device */
2900
    /* then bail out */
2939
    /* then bail out */
2901
    double ascent, descent, width;
2940
    double ascent, descent, width;
-
 
2941
    GEMetricInfo(0, 
-
 
2942
		font, cex, ps,
2902
    GMetricInfo(0, &ascent, &descent, &width, DEVICE, dd);
2943
		&ascent, &descent, &width, dd);
2903
    if ((ascent==0) && (descent==0) && (width==0))
2944
    if ((ascent==0) && (descent==0) && (width==0))
2904
	error("Metric information not yet available for this device");
2945
	error("Metric information not yet available for this device");
2905
#endif
2946
#endif
2906
 
2947
 
2907
    MathDevice = dd;
2948
    MathDevice = dd;
2908
    BaseCex = Rf_gpptr(MathDevice)->cex;
2949
    BaseCex = cex;
2909
    BoxColor = name2col("pink");
2950
    BoxColor = name2col("pink");
2910
    TextColor = Rf_gpptr(MathDevice)->col;
2951
    TextColor = col;
-
 
2952
    MathGamma = gamma;
-
 
2953
    MathFont = font;
-
 
2954
    MathCex = cex;
-
 
2955
    MathPs = ps;
2911
    CurrentStyle = STYLE_D;
2956
    CurrentStyle = STYLE_D;
2912
    SetFont(PlainFont);
2957
    SetFont(PlainFont);
2913
    bbox = RenderElement(expr, 0);
2958
    bbox = RenderElement(expr, 0);
2914
    ReferenceX = x;
2959
    ReferenceX = fromDeviceX(x, GE_INCHES, dd);
2915
    ReferenceY = y;
-
 
2916
    GConvert(&ReferenceX, &ReferenceY, coords, INCHES, dd);
2960
    ReferenceY = fromDeviceY(y, GE_INCHES, dd);
2917
    if (R_FINITE(xc))
2961
    if (R_FINITE(xc))
2918
	CurrentX = ReferenceX - xc * bboxWidth(bbox);
2962
	CurrentX = ReferenceX - xc * bboxWidth(bbox);
2919
    else
2963
    else
2920
	/* Paul 11/2/02
2964
	/* Paul 11/2/02
2921
	 * If xc == NA then should centre horizontally.
2965
	 * If xc == NA then should centre horizontally.
Line 2938... Line 2982...
2938
    SinAngle = sin(rot);
2982
    SinAngle = sin(rot);
2939
    RenderElement(expr, 1);
2983
    RenderElement(expr, 1);
2940
}/* GMathText */
2984
}/* GMathText */
2941
 
2985
 
2942
 
2986
 
-
 
2987
/********************************
-
 
2988
 * Code below here ...
-
 
2989
 * ... should be moved to base.c and 
-
 
2990
 * ... is part of the base graphics API NOT the graphics engine API
-
 
2991
 ********************************
-
 
2992
 */
-
 
2993
double GExpressionWidth(SEXP expr, GUnit units, DevDesc *dd)
-
 
2994
{
-
 
2995
    double width = GEExpressionWidth(expr, 
-
 
2996
				     Rf_gpptr(dd)->font, Rf_gpptr(dd)->cex, 
-
 
2997
				     Rf_gpptr(dd)->ps, (GEDevDesc*) dd);
-
 
2998
    if (units == DEVICE)
-
 
2999
	return width;
-
 
3000
    else
-
 
3001
	return GConvertXUnits(width, DEVICE, units, dd);
-
 
3002
}
-
 
3003
 
-
 
3004
double GExpressionHeight(SEXP expr, GUnit units, DevDesc *dd)
-
 
3005
{
-
 
3006
    double height = GEExpressionHeight(expr, 
-
 
3007
				       Rf_gpptr(dd)->font, Rf_gpptr(dd)->cex, 
-
 
3008
				       Rf_gpptr(dd)->ps, (GEDevDesc*) dd);
-
 
3009
    if (units == DEVICE)
-
 
3010
	return height;
-
 
3011
    else
-
 
3012
	return GConvertYUnits(height, DEVICE, units, dd);
-
 
3013
}
-
 
3014
 
2943
void GMMathText(SEXP str, int side, double line, int outer,
3015
void GMMathText(SEXP str, int side, double line, int outer,
2944
		double at, int las, DevDesc *dd)
3016
		double at, int las, DevDesc *dd)
2945
{
3017
{
2946
    int coords = 0, subcoords;
3018
    int coords = 0, subcoords;
2947
    double xadj, yadj = 0, angle = 0;
3019
    double xadj, yadj = 0, angle = 0;
Line 2954... Line 3026...
2954
    GMetricInfo(0, &ascent, &descent, &width, DEVICE, dd);
3026
    GMetricInfo(0, &ascent, &descent, &width, DEVICE, dd);
2955
    if ((ascent==0) && (descent==0) && (width==0))
3027
    if ((ascent==0) && (descent==0) && (width==0))
2956
	error("Metric information not yet available for this device");
3028
	error("Metric information not yet available for this device");
2957
#endif
3029
#endif
2958
 
3030
 
2959
    MathDevice = dd;
3031
    MathDevice = (GEDevDesc*) dd;
2960
 
3032
 
2961
    xadj = Rf_gpptr(MathDevice)->adj;
3033
    xadj = Rf_gpptr(dd)->adj;
2962
 
3034
 
2963
    /* This is MOSTLY the same as the same section of GMtext
3035
    /* This is MOSTLY the same as the same section of GMtext
2964
     * BUT it differs because it sets different values for yadj for
3036
     * BUT it differs because it sets different values for yadj for
2965
     * different situations.
3037
     * different situations.
2966
     * Paul
3038
     * Paul
Line 3043... Line 3115...
3043
	    angle = 90;
3115
	    angle = 90;
3044
	    yadj = 0;
3116
	    yadj = 0;
3045
	}
3117
	}
3046
	break;
3118
	break;
3047
    }
3119
    }
-
 
3120
    GConvert(&at, &line, coords, DEVICE, dd);
3048
    GMathText(at, line, coords, str, xadj, yadj, angle, dd);
3121
    GEMathText(at, line, str, xadj, yadj, angle, 
-
 
3122
	       Rf_gpptr(dd)->col, Rf_gpptr(dd)->gamma, Rf_gpptr(dd)->font,
-
 
3123
	       Rf_gpptr(dd)->cex, Rf_gpptr(dd)->ps, (GEDevDesc*) dd);
3049
}/* GMMathText */
3124
}/* GMMathText */