The R Project SVN R

Rev

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

Rev 2692 Rev 3244
Line 82... Line 82...
82
	(CurrentY - ReferenceY) * CosAngle +
82
	(CurrentY - ReferenceY) * CosAngle +
83
	(CurrentX - ReferenceX) * SinAngle;
83
	(CurrentX - ReferenceX) * SinAngle;
84
    return rotatedY;
84
    return rotatedY;
85
}
85
}
86
 
86
 
87
static void MoveAcross(double xamount)
87
static void PMoveAcross(double xamount)
88
{
88
{
89
    CurrentX += xamount;
89
    CurrentX += xamount;
90
}
90
}
91
 
91
 
92
static void MoveUp(double yamount)
92
static void PMoveUp(double yamount)
93
{
93
{
94
    CurrentY += yamount;
94
    CurrentY += yamount;
95
}
95
}
96
 
96
 
97
static void MoveTo(double x, double y)
97
static void PMoveTo(double x, double y)
98
{
98
{
99
    CurrentX = x;
99
    CurrentX = x;
100
    CurrentY = y;
100
    CurrentY = y;
101
}
101
}
102
 
102
 
Line 564... Line 564...
564
    double ysaved = CurrentY;
564
    double ysaved = CurrentY;
565
    double x[5], y[5];
565
    double x[5], y[5];
566
    CurrentX += xoffset;
566
    CurrentX += xoffset;
567
    CurrentY += yoffset;
567
    CurrentY += yoffset;
568
    MathDevice->gp.col = BoxColor;
568
    MathDevice->gp.col = BoxColor;
569
    MoveUp(-bboxDepth(bbox));
569
    PMoveUp(-bboxDepth(bbox));
570
    x[4] = x[0] = ConvertedX();
570
    x[4] = x[0] = ConvertedX();
571
    y[4] = y[0] = ConvertedY();
571
    y[4] = y[0] = ConvertedY();
572
    MoveAcross(bboxWidth(bbox));
572
    PMoveAcross(bboxWidth(bbox));
573
    x[1] = ConvertedX();
573
    x[1] = ConvertedX();
574
    y[1] = ConvertedY();
574
    y[1] = ConvertedY();
575
    MoveUp(bboxHeight(bbox) + bboxDepth(bbox));
575
    PMoveUp(bboxHeight(bbox) + bboxDepth(bbox));
576
    x[2] = ConvertedX();
576
    x[2] = ConvertedX();
577
    y[2] = ConvertedY();
577
    y[2] = ConvertedY();
578
    MoveAcross(-bboxWidth(bbox));
578
    PMoveAcross(-bboxWidth(bbox));
579
    x[3] = ConvertedX();
579
    x[3] = ConvertedX();
580
    y[3] = ConvertedY();
580
    y[3] = ConvertedY();
581
    GPolyline(5, x, y, INCHES, MathDevice);
581
    GPolyline(5, x, y, INCHES, MathDevice);
582
    MoveTo(xsaved, ysaved);
582
    PMoveTo(xsaved, ysaved);
583
    MathDevice->gp.col = TextColor;
583
    MathDevice->gp.col = TextColor;
584
    return bbox;
584
    return bbox;
585
}
585
}
586
#endif
586
#endif
587
 
587
 
Line 947... Line 947...
947
 
947
 
948
static BBOX RenderItalicCorr(BBOX bbox, int draw)
948
static BBOX RenderItalicCorr(BBOX bbox, int draw)
949
{
949
{
950
    if (bboxItalic(bbox) > 0) {
950
    if (bboxItalic(bbox) > 0) {
951
	if (draw)
951
	if (draw)
952
	    MoveAcross(bboxItalic(bbox));
952
	    PMoveAcross(bboxItalic(bbox));
953
	bboxWidth(bbox) += bboxItalic(bbox);
953
	bboxWidth(bbox) += bboxItalic(bbox);
954
	bboxItalic(bbox) = 0;
954
	bboxItalic(bbox) = 0;
955
    }
955
    }
956
    return bbox;
956
    return bbox;
957
}
957
}
958
 
958
 
959
static BBOX RenderGap(double gap, int draw)
959
static BBOX RenderGap(double gap, int draw)
960
{
960
{
961
    if (draw)
961
    if (draw)
962
	MoveAcross(gap);
962
	PMoveAcross(gap);
963
    return MakeBBox(0, 0, gap);
963
    return MakeBBox(0, 0, gap);
964
}
964
}
965
 
965
 
966
/* Draw a Symbol from the Special Font */
966
/* Draw a Symbol from the Special Font */
967
 
967
 
Line 978... Line 978...
978
    if (draw) {
978
    if (draw) {
979
	asciiStr[0] = ascii;
979
	asciiStr[0] = ascii;
980
	asciiStr[1] = '\0';
980
	asciiStr[1] = '\0';
981
	GText(ConvertedX(), ConvertedY(), INCHES, asciiStr,
981
	GText(ConvertedX(), ConvertedY(), INCHES, asciiStr,
982
	      0.0, 0.0, CurrentAngle, MathDevice);
982
	      0.0, 0.0, CurrentAngle, MathDevice);
983
	MoveAcross(bboxWidth(bbox));
983
	PMoveAcross(bboxWidth(bbox));
984
    }
984
    }
985
    SetFont(prev);
985
    SetFont(prev);
986
    return bbox;
986
    return bbox;
987
}
987
}
988
 
988
 
Line 1015... Line 1015...
1015
		bboxItalic(glyphBBox) = ItalicFactor * bboxHeight(glyphBBox);
1015
		bboxItalic(glyphBBox) = ItalicFactor * bboxHeight(glyphBBox);
1016
	    else
1016
	    else
1017
		bboxItalic(glyphBBox) = 0;
1017
		bboxItalic(glyphBBox) = 0;
1018
	    if (draw) {
1018
	    if (draw) {
1019
		chr[0] = *s;
1019
		chr[0] = *s;
1020
		MoveAcross(lastItalicCorr);
1020
		PMoveAcross(lastItalicCorr);
1021
		GText(ConvertedX(), ConvertedY(), INCHES, chr,
1021
		GText(ConvertedX(), ConvertedY(), INCHES, chr,
1022
		      0.0, 0.0, CurrentAngle, MathDevice);
1022
		      0.0, 0.0, CurrentAngle, MathDevice);
1023
		MoveAcross(bboxWidth(glyphBBox));
1023
		PMoveAcross(bboxWidth(glyphBBox));
1024
	    }
1024
	    }
1025
	    bboxWidth(resultBBox) += lastItalicCorr;
1025
	    bboxWidth(resultBBox) += lastItalicCorr;
1026
	    resultBBox = CombineBBoxes(resultBBox, glyphBBox);
1026
	    resultBBox = CombineBBoxes(resultBBox, glyphBBox);
1027
	    lastItalicCorr = bboxItalic(glyphBBox);
1027
	    lastItalicCorr = bboxItalic(glyphBBox);
1028
	    s++;
1028
	    s++;
Line 1044... Line 1044...
1044
    if (draw) {
1044
    if (draw) {
1045
	asciiStr[0] = ascii;
1045
	asciiStr[0] = ascii;
1046
	asciiStr[1] = '\0';
1046
	asciiStr[1] = '\0';
1047
	GText(ConvertedX(), ConvertedY(), INCHES, asciiStr,
1047
	GText(ConvertedX(), ConvertedY(), INCHES, asciiStr,
1048
	      0.0, 0.0, CurrentAngle, MathDevice);
1048
	      0.0, 0.0, CurrentAngle, MathDevice);
1049
	MoveAcross(bboxWidth(bbox));
1049
	PMoveAcross(bboxWidth(bbox));
1050
    }
1050
    }
1051
    return bbox;
1051
    return bbox;
1052
}
1052
}
1053
 
1053
 
1054
static BBOX RenderStr(char *str, int draw)
1054
static BBOX RenderStr(char *str, int draw)
Line 1063... Line 1063...
1063
	    s++;
1063
	    s++;
1064
	}
1064
	}
1065
	if (draw) {
1065
	if (draw) {
1066
	    GText(ConvertedX(), ConvertedY(), INCHES, str,
1066
	    GText(ConvertedX(), ConvertedY(), INCHES, str,
1067
		  0.0, 0.0, CurrentAngle, MathDevice);
1067
		  0.0, 0.0, CurrentAngle, MathDevice);
1068
	    MoveAcross(bboxWidth(resultBBox));
1068
	    PMoveAcross(bboxWidth(resultBBox));
1069
	}
1069
	}
1070
	if (UsingItalics())
1070
	if (UsingItalics())
1071
	    bboxItalic(resultBBox) = ItalicFactor * bboxHeight(glyphBBox);
1071
	    bboxItalic(resultBBox) = ItalicFactor * bboxHeight(glyphBBox);
1072
	else
1072
	else
1073
	    bboxItalic(resultBBox) = 0;
1073
	    bboxItalic(resultBBox) = 0;
Line 1131... Line 1131...
1131
{
1131
{
1132
    BBOX bbox = RenderSymbolChar(S_ELLIPSIS, 0);
1132
    BBOX bbox = RenderSymbolChar(S_ELLIPSIS, 0);
1133
    if (NameMatch(expr, "cdots") || NameMatch(expr, "...")) {
1133
    if (NameMatch(expr, "cdots") || NameMatch(expr, "...")) {
1134
	double shift = AxisHeight() - 0.5 * bboxHeight(bbox);
1134
	double shift = AxisHeight() - 0.5 * bboxHeight(bbox);
1135
	if (draw) {
1135
	if (draw) {
1136
	    MoveUp(shift);
1136
	    PMoveUp(shift);
1137
	    RenderSymbolChar(S_ELLIPSIS, 1);
1137
	    RenderSymbolChar(S_ELLIPSIS, 1);
1138
	    MoveUp(-shift);
1138
	    PMoveUp(-shift);
1139
	}
1139
	}
1140
	return ShiftBBox(bbox, shift);
1140
	return ShiftBBox(bbox, shift);
1141
    }
1141
    }
1142
    else {
1142
    else {
1143
	if (draw)
1143
	if (draw)
Line 1243... Line 1243...
1243
    double height1, height2;
1243
    double height1, height2;
1244
    height1 = bboxHeight(RenderSymbolChar(S_SLASH, 0));
1244
    height1 = bboxHeight(RenderSymbolChar(S_SLASH, 0));
1245
    MathDevice->gp.cex = 1.2 * MathDevice->gp.cex;
1245
    MathDevice->gp.cex = 1.2 * MathDevice->gp.cex;
1246
    height2 = bboxHeight(RenderSymbolChar(S_SLASH, 0));
1246
    height2 = bboxHeight(RenderSymbolChar(S_SLASH, 0));
1247
    if (draw)
1247
    if (draw)
1248
	MoveUp(- 0.5 * (height2 - height1));
1248
	PMoveUp(- 0.5 * (height2 - height1));
1249
    bbox = RenderSymbolChar(S_SLASH, draw);
1249
    bbox = RenderSymbolChar(S_SLASH, draw);
1250
    if (draw)
1250
    if (draw)
1251
	MoveUp(0.5 * (height2 - height1));
1251
	PMoveUp(0.5 * (height2 - height1));
1252
    MathDevice->gp.cex = savecex;
1252
    MathDevice->gp.cex = savecex;
1253
    return bbox;
1253
    return bbox;
1254
#endif
1254
#endif
1255
#ifdef SLASH2
1255
#ifdef SLASH2
1256
    /* Line Drawing Version */
1256
    /* Line Drawing Version */
1257
    double x[2], y[2];
1257
    double x[2], y[2];
1258
    double depth = 0.5 * TeX(sigma22);
1258
    double depth = 0.5 * TeX(sigma22);
1259
    double height = XHeight() + 0.5 * TeX(sigma22);
1259
    double height = XHeight() + 0.5 * TeX(sigma22);
1260
    double width = 0.5 * xHeight();
1260
    double width = 0.5 * xHeight();
1261
    if (draw) {
1261
    if (draw) {
1262
	MoveAcross(0.5 * width);
1262
	PMoveAcross(0.5 * width);
1263
	MoveUp(-depth);
1263
	PMoveUp(-depth);
1264
	x[0] = ConvertedX();
1264
	x[0] = ConvertedX();
1265
	y[0] = ConvertedY();
1265
	y[0] = ConvertedY();
1266
	MoveAcross(width);
1266
	PMoveAcross(width);
1267
	MoveUp(depth + height);
1267
	PMoveUp(depth + height);
1268
	x[1] = ConvertedX();
1268
	x[1] = ConvertedX();
1269
	y[1] = ConvertedY();
1269
	y[1] = ConvertedY();
1270
	MoveUp(-height);
1270
	PMoveUp(-height);
1271
	GPolyline(2, x, y, INCHES, MathDevice);
1271
	GPolyline(2, x, y, INCHES, MathDevice);
1272
	MoveAcross(0.5 * width);
1272
	PMoveAcross(0.5 * width);
1273
    }
1273
    }
1274
    return MakeBBox(height, depth, 2 * width);
1274
    return MakeBBox(height, depth, 2 * width);
1275
#endif
1275
#endif
1276
#ifdef SLASH3
1276
#ifdef SLASH3
1277
    /* Offset Overprinting - A Failure! */
1277
    /* Offset Overprinting - A Failure! */
Line 1281... Line 1281...
1281
    double depth = bboxDepth(slashBBox);
1281
    double depth = bboxDepth(slashBBox);
1282
    double width = bboxWidth(slashBBox);
1282
    double width = bboxWidth(slashBBox);
1283
    double slope = (height + depth) / slope;
1283
    double slope = (height + depth) / slope;
1284
    double delta = TeX(sigma22);
1284
    double delta = TeX(sigma22);
1285
    if (draw)
1285
    if (draw)
1286
	MoveUp(-delta);
1286
	PMoveUp(-delta);
1287
    ansBBox = ShiftBBox(RenderSymbolChar(S_SLASH, draw), -delta);
1287
    ansBBox = ShiftBBox(RenderSymbolChar(S_SLASH, draw), -delta);
1288
    MoveUp(2 * delta);
1288
    PMoveUp(2 * delta);
1289
    ansBBox = CombineBBoxes(ansBBox, RenderGap(2 * delta / slope, draw));
1289
    ansBBox = CombineBBoxes(ansBBox, RenderGap(2 * delta / slope, draw));
1290
    ansBBox = ShiftBBox(RenderSymbolChar(S_SLASH, draw), 2 * delta);
1290
    ansBBox = ShiftBBox(RenderSymbolChar(S_SLASH, draw), 2 * delta);
1291
    MoveUp(-delta);
1291
    PMoveUp(-delta);
1292
    return ansBBox;
1292
    return ansBBox;
1293
#endif
1293
#endif
1294
}
1294
}
1295
 
1295
 
1296
static BBOX RenderBin(SEXP expr, int draw)
1296
static BBOX RenderBin(SEXP expr, int draw)
Line 1375... Line 1375...
1375
    v = max(max(v, s16), bboxHeight(subBBox) - 0.8 * sigma5);
1375
    v = max(max(v, s16), bboxHeight(subBBox) - 0.8 * sigma5);
1376
    subBBox = RenderOffsetElement(sub, 0, -v, draw);
1376
    subBBox = RenderOffsetElement(sub, 0, -v, draw);
1377
    bodyBBox = CombineBBoxes(bodyBBox, subBBox);
1377
    bodyBBox = CombineBBoxes(bodyBBox, subBBox);
1378
    SetStyle(style);
1378
    SetStyle(style);
1379
    if (draw)
1379
    if (draw)
1380
	MoveTo(savedX + bboxWidth(bodyBBox), savedY);
1380
	PMoveTo(savedX + bboxWidth(bodyBBox), savedY);
1381
    return bodyBBox;
1381
    return bodyBBox;
1382
}
1382
}
1383
 
1383
 
1384
static BBOX RenderSup(SEXP expr, int draw)
1384
static BBOX RenderSup(SEXP expr, int draw)
1385
{
1385
{
Line 1435... Line 1435...
1435
		u += psi;
1435
		u += psi;
1436
		v -= psi;
1436
		v -= psi;
1437
	    }
1437
	    }
1438
	}
1438
	}
1439
	if (draw)
1439
	if (draw)
1440
	    MoveTo(savedX, savedY);
1440
	    PMoveTo(savedX, savedY);
1441
	subBBox = RenderOffsetElement(sub, width, -v, draw);
1441
	subBBox = RenderOffsetElement(sub, width, -v, draw);
1442
	if (draw)
1442
	if (draw)
1443
	    MoveTo(savedX, savedY);
1443
	    PMoveTo(savedX, savedY);
1444
	SetSupStyle(style);
1444
	SetSupStyle(style);
1445
	supBBox = RenderOffsetElement(sup, width + delta, u, draw);
1445
	supBBox = RenderOffsetElement(sup, width + delta, u, draw);
1446
	bodyBBox = CombineAlignedBBoxes(bodyBBox, subBBox);
1446
	bodyBBox = CombineAlignedBBoxes(bodyBBox, subBBox);
1447
	bodyBBox = CombineAlignedBBoxes(bodyBBox, supBBox);
1447
	bodyBBox = CombineAlignedBBoxes(bodyBBox, supBBox);
1448
    }
1448
    }
1449
    else {
1449
    else {
1450
	supBBox = RenderOffsetElement(sup, 0, u, draw);
1450
	supBBox = RenderOffsetElement(sup, 0, u, draw);
1451
	bodyBBox = CombineBBoxes(bodyBBox, supBBox);
1451
	bodyBBox = CombineBBoxes(bodyBBox, supBBox);
1452
    }
1452
    }
1453
    if (draw)
1453
    if (draw)
1454
	MoveTo(savedX + bboxWidth(bodyBBox), savedY);
1454
	PMoveTo(savedX + bboxWidth(bodyBBox), savedY);
1455
    SetStyle(style);
1455
    SetStyle(style);
1456
    return bodyBBox;
1456
    return bodyBBox;
1457
}
1457
}
1458
 
1458
 
1459
 
1459
 
Line 1492... Line 1492...
1492
    int i;
1492
    int i;
1493
 
1493
 
1494
    if (draw) {
1494
    if (draw) {
1495
	baseX = savedX;
1495
	baseX = savedX;
1496
	baseY = savedY + height + accentGap;
1496
	baseY = savedY + height + accentGap;
1497
	MoveTo(baseX, baseY);
1497
	PMoveTo(baseX, baseY);
1498
	x[0] = ConvertedX();
1498
	x[0] = ConvertedX();
1499
	y[0] = ConvertedY();
1499
	y[0] = ConvertedY();
1500
	for (i = 0; i <= NTILDE; i++) {
1500
	for (i = 0; i <= NTILDE; i++) {
1501
	    xval = start + i * delta;
1501
	    xval = start + i * delta;
1502
	    yval = 0.5 * hatHeight * (sin(c * i) + 1);
1502
	    yval = 0.5 * hatHeight * (sin(c * i) + 1);
1503
	    MoveTo(baseX + xval, baseY + yval);
1503
	    PMoveTo(baseX + xval, baseY + yval);
1504
	    x[i + 1] = ConvertedX();
1504
	    x[i + 1] = ConvertedX();
1505
	    y[i + 1] = ConvertedY();
1505
	    y[i + 1] = ConvertedY();
1506
	}
1506
	}
1507
	MoveTo(baseX + totalwidth, baseY + hatHeight);
1507
	PMoveTo(baseX + totalwidth, baseY + hatHeight);
1508
	x[NTILDE + 2] = ConvertedX();
1508
	x[NTILDE + 2] = ConvertedX();
1509
	y[NTILDE + 2] = ConvertedY();
1509
	y[NTILDE + 2] = ConvertedY();
1510
	GPolyline(NTILDE + 3, x, y, INCHES, MathDevice);
1510
	GPolyline(NTILDE + 3, x, y, INCHES, MathDevice);
1511
	MoveTo(savedX + totalwidth, savedY);
1511
	PMoveTo(savedX + totalwidth, savedY);
1512
    }
1512
    }
1513
    return MakeBBox(height + accentGap + hatHeight,
1513
    return MakeBBox(height + accentGap + hatHeight,
1514
		    bboxDepth(bbox), totalwidth);
1514
		    bboxDepth(bbox), totalwidth);
1515
}
1515
}
1516
 
1516
 
Line 1530... Line 1530...
1530
    double height = bboxHeight(bbox);
1530
    double height = bboxHeight(bbox);
1531
    double width = bboxWidth(bbox);
1531
    double width = bboxWidth(bbox);
1532
    double x[3], y[3];
1532
    double x[3], y[3];
1533
 
1533
 
1534
    if (draw) {
1534
    if (draw) {
1535
	MoveTo(savedX, savedY + height + accentGap);
1535
	PMoveTo(savedX, savedY + height + accentGap);
1536
	x[0] = ConvertedX();
1536
	x[0] = ConvertedX();
1537
	y[0] = ConvertedY();
1537
	y[0] = ConvertedY();
1538
	MoveAcross(0.5 * totalwidth);
1538
	PMoveAcross(0.5 * totalwidth);
1539
	MoveUp(hatHeight);
1539
	PMoveUp(hatHeight);
1540
	x[1] = ConvertedX();
1540
	x[1] = ConvertedX();
1541
	y[1] = ConvertedY();
1541
	y[1] = ConvertedY();
1542
	MoveAcross(0.5 * totalwidth);
1542
	PMoveAcross(0.5 * totalwidth);
1543
	MoveUp(-hatHeight);
1543
	PMoveUp(-hatHeight);
1544
	x[2] = ConvertedX();
1544
	x[2] = ConvertedX();
1545
	y[2] = ConvertedY();
1545
	y[2] = ConvertedY();
1546
	GPolyline(3, x, y, INCHES, MathDevice);
1546
	GPolyline(3, x, y, INCHES, MathDevice);
1547
	MoveTo(savedX + width, savedY);
1547
	PMoveTo(savedX + width, savedY);
1548
    }
1548
    }
1549
    return EnlargeBBox(bbox, accentGap + hatHeight, 0, 0);
1549
    return EnlargeBBox(bbox, accentGap + hatHeight, 0, 0);
1550
}
1550
}
1551
 
1551
 
1552
static int BarAtom(SEXP expr)
1552
static int BarAtom(SEXP expr)
Line 1565... Line 1565...
1565
    double width = bboxWidth(bbox);
1565
    double width = bboxWidth(bbox);
1566
    double offset = bboxItalic(bbox);
1566
    double offset = bboxItalic(bbox);
1567
    double x[2], y[2];
1567
    double x[2], y[2];
1568
 
1568
 
1569
    if (draw) {
1569
    if (draw) {
1570
	MoveTo(savedX + offset, savedY + height + accentGap);
1570
	PMoveTo(savedX + offset, savedY + height + accentGap);
1571
	x[0] = ConvertedX();
1571
	x[0] = ConvertedX();
1572
	y[0] = ConvertedY();
1572
	y[0] = ConvertedY();
1573
	MoveAcross(width);
1573
	PMoveAcross(width);
1574
	x[1] = ConvertedX();
1574
	x[1] = ConvertedX();
1575
	y[1] = ConvertedY();
1575
	y[1] = ConvertedY();
1576
	GPolyline(2, x, y, INCHES, MathDevice);
1576
	GPolyline(2, x, y, INCHES, MathDevice);
1577
	MoveTo(savedX + width, savedY);
1577
	PMoveTo(savedX + width, savedY);
1578
    }
1578
    }
1579
    return EnlargeBBox(bbox, accentGap, 0, 0);
1579
    return EnlargeBBox(bbox, accentGap, 0, 0);
1580
}
1580
}
1581
 
1581
 
1582
static struct {
1582
static struct {
Line 1631... Line 1631...
1631
		bboxWidth(accentBBox));
1631
		bboxWidth(accentBBox));
1632
    xoffset = 0.5 *(width - bboxWidth(bodyBBox));
1632
    xoffset = 0.5 *(width - bboxWidth(bodyBBox));
1633
    bodyBBox = RenderGap(xoffset, draw);
1633
    bodyBBox = RenderGap(xoffset, draw);
1634
    bodyBBox = CombineBBoxes(bodyBBox, RenderElement(body, draw));
1634
    bodyBBox = CombineBBoxes(bodyBBox, RenderElement(body, draw));
1635
    bodyBBox = CombineBBoxes(bodyBBox, RenderGap(xoffset, draw));
1635
    bodyBBox = CombineBBoxes(bodyBBox, RenderGap(xoffset, draw));
1636
    MoveTo(savedX, savedY);
1636
    PMoveTo(savedX, savedY);
1637
    xoffset = 0.5 *(width - bboxWidth(accentBBox))
1637
    xoffset = 0.5 *(width - bboxWidth(accentBBox))
1638
	+ 0.9 * italic;
1638
	+ 0.9 * italic;
1639
    yoffset = bboxHeight(bodyBBox) + bboxDepth(accentBBox) + 0.1 * XHeight();
1639
    yoffset = bboxHeight(bodyBBox) + bboxDepth(accentBBox) + 0.1 * XHeight();
1640
    if (draw) {
1640
    if (draw) {
1641
	MoveTo(savedX + xoffset, savedY + yoffset);
1641
	PMoveTo(savedX + xoffset, savedY + yoffset);
1642
	RenderChar(code, draw);
1642
	RenderChar(code, draw);
1643
    }
1643
    }
1644
    bodyBBox = CombineOffsetBBoxes(bodyBBox, 0, accentBBox, 0,
1644
    bodyBBox = CombineOffsetBBoxes(bodyBBox, 0, accentBBox, 0,
1645
				   xoffset, yoffset);
1645
				   xoffset, yoffset);
1646
    MoveTo(savedX + width, savedY);
1646
    PMoveTo(savedX + width, savedY);
1647
    return bodyBBox;
1647
    return bodyBBox;
1648
}
1648
}
1649
 
1649
 
1650
 
1650
 
1651
/*----------------------------------------------------------------------
1651
/*----------------------------------------------------------------------
Line 1732... Line 1732...
1732
 
1732
 
1733
    if (draw) {
1733
    if (draw) {
1734
	if (rule) {
1734
	if (rule) {
1735
	    CurrentX = savedX;
1735
	    CurrentX = savedX;
1736
	    CurrentY = savedY;
1736
	    CurrentY = savedY;
1737
	    MoveUp(AxisHeight());
1737
	    PMoveUp(AxisHeight());
1738
	    x[0] = ConvertedX();
1738
	    x[0] = ConvertedX();
1739
	    y[0] = ConvertedY();
1739
	    y[0] = ConvertedY();
1740
	    MoveAcross(width);
1740
	    PMoveAcross(width);
1741
	    x[1] = ConvertedX();
1741
	    x[1] = ConvertedX();
1742
	    y[1] = ConvertedY();
1742
	    y[1] = ConvertedY();
1743
	    GPolyline(2, x, y, INCHES, MathDevice);
1743
	    GPolyline(2, x, y, INCHES, MathDevice);
1744
	    MoveUp(-AxisHeight());
1744
	    PMoveUp(-AxisHeight());
1745
	}
1745
	}
1746
	MoveTo(savedX + width, savedY);
1746
	PMoveTo(savedX + width, savedY);
1747
    }
1747
    }
1748
    return CombineAlignedBBoxes(numBBox, denomBBox);
1748
    return CombineAlignedBBoxes(numBBox, denomBBox);
1749
}
1749
}
1750
 
1750
 
1751
static int OverAtom(SEXP expr)
1751
static int OverAtom(SEXP expr)
Line 1935... Line 1935...
1935
	midShift = axisHeight
1935
	midShift = axisHeight
1936
	    - 0.5 * (bboxHeight(midBBox) - bboxDepth(midBBox));
1936
	    - 0.5 * (bboxHeight(midBBox) - bboxDepth(midBBox));
1937
	midBBox = ShiftBBox(midBBox, midShift);
1937
	midBBox = ShiftBBox(midBBox, midShift);
1938
	ansBBox = CombineAlignedBBoxes(ansBBox, midBBox);
1938
	ansBBox = CombineAlignedBBoxes(ansBBox, midBBox);
1939
	if (draw) {
1939
	if (draw) {
1940
	    MoveTo(savedX, savedY + topShift);
1940
	    PMoveTo(savedX, savedY + topShift);
1941
	    RenderSymbolChar(top, draw);
1941
	    RenderSymbolChar(top, draw);
1942
	    MoveTo(savedX, savedY + midShift);
1942
	    PMoveTo(savedX, savedY + midShift);
1943
	    RenderSymbolChar(mid, draw);
1943
	    RenderSymbolChar(mid, draw);
1944
	    MoveTo(savedX, savedY - botShift);
1944
	    PMoveTo(savedX, savedY - botShift);
1945
	    RenderSymbolChar(bot, draw);
1945
	    RenderSymbolChar(bot, draw);
1946
	    MoveTo(savedX + bboxWidth(ansBBox), savedY);
1946
	    PMoveTo(savedX + bboxWidth(ansBBox), savedY);
1947
	}
1947
	}
1948
    }
1948
    }
1949
    else {
1949
    else {
1950
	if (draw) {
1950
	if (draw) {
1951
	    /* draw the top and bottom elements */
1951
	    /* draw the top and bottom elements */
1952
	    MoveTo(savedX, savedY + topShift);
1952
	    PMoveTo(savedX, savedY + topShift);
1953
	    RenderSymbolChar(top, draw);
1953
	    RenderSymbolChar(top, draw);
1954
	    MoveTo(savedX, savedY - botShift);
1954
	    PMoveTo(savedX, savedY - botShift);
1955
	    RenderSymbolChar(bot, draw);
1955
	    RenderSymbolChar(bot, draw);
1956
	    /* now join with extenders */
1956
	    /* now join with extenders */
1957
	    ytop = axisHeight + dist
1957
	    ytop = axisHeight + dist
1958
		- (bboxHeight(topBBox) + bboxDepth(topBBox));
1958
		- (bboxHeight(topBBox) + bboxDepth(topBBox));
1959
	    ybot = axisHeight - dist
1959
	    ybot = axisHeight - dist
1960
		+ (bboxHeight(botBBox) + bboxDepth(botBBox));
1960
		+ (bboxHeight(botBBox) + bboxDepth(botBBox));
1961
	    n = ceil((ytop - ybot) / (0.99 * extHeight));
1961
	    n = ceil((ytop - ybot) / (0.99 * extHeight));
1962
	    if (n > 0) {
1962
	    if (n > 0) {
1963
		delta = (ytop - ybot) / n;
1963
		delta = (ytop - ybot) / n;
1964
		for (i = 0; i < n; i++) {
1964
		for (i = 0; i < n; i++) {
1965
		    MoveTo(savedX, savedY + ybot + (i + 0.5) * delta - extShift);
1965
		    PMoveTo(savedX, savedY + ybot + (i + 0.5) * delta - extShift);
1966
		    RenderSymbolChar(ext, draw);
1966
		    RenderSymbolChar(ext, draw);
1967
		}
1967
		}
1968
	    }
1968
	    }
1969
	    MoveTo(savedX + bboxWidth(ansBBox), savedY);
1969
	    PMoveTo(savedX + bboxWidth(ansBBox), savedY);
1970
 
1970
 
1971
	}
1971
	}
1972
    }
1972
    }
1973
    SetFont(prev);
1973
    SetFont(prev);
1974
    return ansBBox;
1974
    return ansBBox;
Line 2034... Line 2034...
2034
    if (GetStyle() > STYLE_T) {
2034
    if (GetStyle() > STYLE_T) {
2035
	BBOX bbox1 = RenderSymbolChar(243, 0);
2035
	BBOX bbox1 = RenderSymbolChar(243, 0);
2036
	BBOX bbox2 = RenderSymbolChar(245, 0);
2036
	BBOX bbox2 = RenderSymbolChar(245, 0);
2037
	double shift;
2037
	double shift;
2038
	shift = TeX(sigma22) + 0.99 * bboxDepth(bbox1);
2038
	shift = TeX(sigma22) + 0.99 * bboxDepth(bbox1);
2039
	MoveUp(shift);
2039
	PMoveUp(shift);
2040
	bbox1 = ShiftBBox(RenderSymbolChar(243, draw), shift);
2040
	bbox1 = ShiftBBox(RenderSymbolChar(243, draw), shift);
2041
	CurrentX = savedX;
2041
	CurrentX = savedX;
2042
	CurrentY = savedY;
2042
	CurrentY = savedY;
2043
	shift = TeX(sigma22) - 0.99 * bboxHeight(bbox2);
2043
	shift = TeX(sigma22) - 0.99 * bboxHeight(bbox2);
2044
	MoveUp(shift);
2044
	PMoveUp(shift);
2045
	bbox2 = ShiftBBox(RenderSymbolChar(245, draw), shift);
2045
	bbox2 = ShiftBBox(RenderSymbolChar(245, draw), shift);
2046
	if (draw)
2046
	if (draw)
2047
	    MoveTo(savedX + max(bboxWidth(bbox1), bboxWidth(bbox2)), savedY);
2047
	    PMoveTo(savedX + max(bboxWidth(bbox1), bboxWidth(bbox2)), savedY);
2048
	else
2048
	else
2049
	    MoveTo(savedX, savedY);
2049
	    PMoveTo(savedX, savedY);
2050
	return CombineAlignedBBoxes(bbox1, bbox2);
2050
	return CombineAlignedBBoxes(bbox1, bbox2);
2051
    }
2051
    }
2052
    else {
2052
    else {
2053
	return RenderSymbolChar(0362, draw);
2053
	return RenderSymbolChar(0362, draw);
2054
    }
2054
    }
Line 2087... Line 2087...
2087
	opBBox = CombineAlignedBBoxes(opBBox, upperBBox);
2087
	opBBox = CombineAlignedBBoxes(opBBox, upperBBox);
2088
	SetStyle(style);
2088
	SetStyle(style);
2089
	CurrentX = savedX;
2089
	CurrentX = savedX;
2090
	CurrentY = savedY;
2090
	CurrentY = savedY;
2091
    }
2091
    }
2092
    MoveAcross(bboxWidth(opBBox));
2092
    PMoveAcross(bboxWidth(opBBox));
2093
    if (nexpr > 1) {
2093
    if (nexpr > 1) {
2094
	bodyBBox = RenderElement(CADR(expr), draw);
2094
	bodyBBox = RenderElement(CADR(expr), draw);
2095
	opBBox = CombineBBoxes(opBBox, bodyBBox);
2095
	opBBox = CombineBBoxes(opBBox, bodyBBox);
2096
    }
2096
    }
2097
    return opBBox;
2097
    return opBBox;
Line 2144... Line 2144...
2144
	if (display) {
2144
	if (display) {
2145
	    MathDevice->gp.cex = OperatorSymbolMag * MathDevice->gp.cex;
2145
	    MathDevice->gp.cex = OperatorSymbolMag * MathDevice->gp.cex;
2146
	    bbox = RenderSymbolChar(OpAtom(op), 0);
2146
	    bbox = RenderSymbolChar(OpAtom(op), 0);
2147
	    shift = 0.5 * (bboxHeight(bbox) - bboxDepth(bbox)) - TeX(sigma22);
2147
	    shift = 0.5 * (bboxHeight(bbox) - bboxDepth(bbox)) - TeX(sigma22);
2148
	    if (draw) {
2148
	    if (draw) {
2149
		MoveUp(-shift);
2149
		PMoveUp(-shift);
2150
		bbox = RenderSymbolChar(opId, 1);
2150
		bbox = RenderSymbolChar(opId, 1);
2151
		MoveUp(shift);
2151
		PMoveUp(shift);
2152
	    }
2152
	    }
2153
	    MathDevice->gp.cex = cexSaved;
2153
	    MathDevice->gp.cex = cexSaved;
2154
	    return ShiftBBox(bbox, -shift);
2154
	    return ShiftBBox(bbox, -shift);
2155
	}
2155
	}
2156
	else return RenderSymbolChar(opId, draw);
2156
	else return RenderSymbolChar(opId, draw);
Line 2212... Line 2212...
2212
	CurrentX = savedX;
2212
	CurrentX = savedX;
2213
	CurrentY = savedY;
2213
	CurrentY = savedY;
2214
    }
2214
    }
2215
    opBBox = EnlargeBBox(opBBox, TeX(xi13), TeX(xi13), 0);
2215
    opBBox = EnlargeBBox(opBBox, TeX(xi13), TeX(xi13), 0);
2216
    if (draw)
2216
    if (draw)
2217
	MoveAcross(width);
2217
	PMoveAcross(width);
2218
    opBBox = CombineBBoxes(opBBox, RenderGap(ThinSpace(), draw));
2218
    opBBox = CombineBBoxes(opBBox, RenderGap(ThinSpace(), draw));
2219
    bodyBBox = RenderElement(CADR(expr), draw);
2219
    bodyBBox = RenderElement(CADR(expr), draw);
2220
    return CombineBBoxes(opBBox, bodyBBox);
2220
    return CombineBBoxes(opBBox, bodyBBox);
2221
}
2221
}
2222
 
2222
 
Line 2287... Line 2287...
2287
	hshift = leadWidth - bboxWidth(orderBBox) - 0.4 * radWidth;
2287
	hshift = leadWidth - bboxWidth(orderBBox) - 0.4 * radWidth;
2288
	vshift = leadHeight - bboxHeight(orderBBox);
2288
	vshift = leadHeight - bboxHeight(orderBBox);
2289
	if (vshift - bboxDepth(orderBBox) < twiddleHeight + radGap)
2289
	if (vshift - bboxDepth(orderBBox) < twiddleHeight + radGap)
2290
	    vshift = twiddleHeight + bboxDepth(orderBBox) + radGap;
2290
	    vshift = twiddleHeight + bboxDepth(orderBBox) + radGap;
2291
	if (draw) {
2291
	if (draw) {
2292
	    MoveTo(savedX + hshift, savedY + vshift);
2292
	    PMoveTo(savedX + hshift, savedY + vshift);
2293
	    orderBBox = RenderScript(order, draw);
2293
	    orderBBox = RenderScript(order, draw);
2294
	}
2294
	}
2295
	orderBBox = EnlargeBBox(orderBBox, vshift, 0, hshift);
2295
	orderBBox = EnlargeBBox(orderBBox, vshift, 0, hshift);
2296
    }
2296
    }
2297
    else
2297
    else
2298
	orderBBox = NullBBox();
2298
	orderBBox = NullBBox();
2299
    if (draw) {
2299
    if (draw) {
2300
	MoveTo(savedX + leadWidth - radWidth, savedY);
2300
	PMoveTo(savedX + leadWidth - radWidth, savedY);
2301
	MoveUp(0.8 * twiddleHeight);
2301
	PMoveUp(0.8 * twiddleHeight);
2302
	x[0] = ConvertedX();
2302
	x[0] = ConvertedX();
2303
	y[0] = ConvertedY();
2303
	y[0] = ConvertedY();
2304
	MoveUp(0.2 * twiddleHeight);
2304
	PMoveUp(0.2 * twiddleHeight);
2305
	MoveAcross(0.3 * radWidth);
2305
	PMoveAcross(0.3 * radWidth);
2306
	x[1] = ConvertedX();
2306
	x[1] = ConvertedX();
2307
	y[1] = ConvertedY();
2307
	y[1] = ConvertedY();
2308
	MoveUp(-(twiddleHeight + bboxDepth(bodyBBox)));
2308
	PMoveUp(-(twiddleHeight + bboxDepth(bodyBBox)));
2309
	MoveAcross(0.3 * radWidth);
2309
	PMoveAcross(0.3 * radWidth);
2310
	x[2] = ConvertedX();
2310
	x[2] = ConvertedX();
2311
	y[2] = ConvertedY();
2311
	y[2] = ConvertedY();
2312
	MoveUp(bboxDepth(bodyBBox) + bboxHeight(bodyBBox) + radGap);
2312
	PMoveUp(bboxDepth(bodyBBox) + bboxHeight(bodyBBox) + radGap);
2313
	MoveAcross(0.4 * radWidth);
2313
	PMoveAcross(0.4 * radWidth);
2314
	x[3] = ConvertedX();
2314
	x[3] = ConvertedX();
2315
	y[3] = ConvertedY();
2315
	y[3] = ConvertedY();
2316
	MoveAcross(radSpace + bboxWidth(bodyBBox) + radTrail);
2316
	PMoveAcross(radSpace + bboxWidth(bodyBBox) + radTrail);
2317
	x[4] = ConvertedX();
2317
	x[4] = ConvertedX();
2318
	y[4] = ConvertedY();
2318
	y[4] = ConvertedY();
2319
	GPolyline(5, x, y, INCHES, MathDevice);
2319
	GPolyline(5, x, y, INCHES, MathDevice);
2320
	MoveTo(savedX, savedY);
2320
	PMoveTo(savedX, savedY);
2321
    }
2321
    }
2322
    orderBBox = CombineAlignedBBoxes(orderBBox,
2322
    orderBBox = CombineAlignedBBoxes(orderBBox,
2323
				     RenderGap(leadWidth + radSpace, draw));
2323
				     RenderGap(leadWidth + radSpace, draw));
2324
    SetPrimeStyle(style);
2324
    SetPrimeStyle(style);
2325
    orderBBox = CombineBBoxes(orderBBox, RenderElement(body, draw));
2325
    orderBBox = CombineBBoxes(orderBBox, RenderElement(body, draw));
Line 2346... Line 2346...
2346
    double depth = bboxDepth(bbox);
2346
    double depth = bboxDepth(bbox);
2347
    double x[2], y[2];
2347
    double x[2], y[2];
2348
 
2348
 
2349
    bbox= RenderGap(MuSpace(), draw);
2349
    bbox= RenderGap(MuSpace(), draw);
2350
    if (draw) {
2350
    if (draw) {
2351
	MoveUp(-depth);
2351
	PMoveUp(-depth);
2352
	x[0] = ConvertedX();
2352
	x[0] = ConvertedX();
2353
	y[0] = ConvertedY();
2353
	y[0] = ConvertedY();
2354
	MoveUp(depth + height);
2354
	PMoveUp(depth + height);
2355
	x[1] = ConvertedX();
2355
	x[1] = ConvertedX();
2356
	y[1] = ConvertedY();
2356
	y[1] = ConvertedY();
2357
	GPolyline(2, x, y, INCHES, MathDevice);
2357
	GPolyline(2, x, y, INCHES, MathDevice);
2358
	MoveUp(-height);
2358
	PMoveUp(-height);
2359
    }
2359
    }
2360
    bbox = CombineBBoxes(bbox, RenderGap(MuSpace(), draw));
2360
    bbox = CombineBBoxes(bbox, RenderGap(MuSpace(), draw));
2361
    bbox = CombineBBoxes(bbox, RenderElement(CADR(expr), draw));
2361
    bbox = CombineBBoxes(bbox, RenderElement(CADR(expr), draw));
2362
    bbox = RenderItalicCorr(bbox, draw);
2362
    bbox = RenderItalicCorr(bbox, draw);
2363
    bbox = CombineBBoxes(bbox, RenderGap(MuSpace(), draw));
2363
    bbox = CombineBBoxes(bbox, RenderGap(MuSpace(), draw));
2364
    if (draw) {
2364
    if (draw) {
2365
	MoveUp(-depth);
2365
	PMoveUp(-depth);
2366
	x[0] = ConvertedX();
2366
	x[0] = ConvertedX();
2367
	y[0] = ConvertedY();
2367
	y[0] = ConvertedY();
2368
	MoveUp(depth + height);
2368
	PMoveUp(depth + height);
2369
	x[1] = ConvertedX();
2369
	x[1] = ConvertedX();
2370
	y[1] = ConvertedY();
2370
	y[1] = ConvertedY();
2371
	GPolyline(2, x, y, INCHES, MathDevice);
2371
	GPolyline(2, x, y, INCHES, MathDevice);
2372
	MoveUp(-height);
2372
	PMoveUp(-height);
2373
    }
2373
    }
2374
    bbox = CombineBBoxes(bbox, RenderGap(MuSpace(), draw));
2374
    bbox = CombineBBoxes(bbox, RenderGap(MuSpace(), draw));
2375
    return bbox;
2375
    return bbox;
2376
}
2376
}
2377
 
2377