The R Project SVN R

Rev

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

Rev 10172 Rev 10886
Line 36... Line 36...
36
 
36
 
37
static DevDesc *MathDevice;
37
static DevDesc *MathDevice;
38
static unsigned int BoxColor;
38
static unsigned int BoxColor;
39
static unsigned int TextColor;
39
static unsigned int TextColor;
40
static double BaseCex = 1;
40
static double BaseCex = 1;
41
static int MetricUnit = INCHES;
41
static GUnit MetricUnit = INCHES;
42
 
42
 
43
/* Font Definitions */
43
/* Font Definitions */
44
 
44
 
45
typedef enum {
45
typedef enum {
46
    PlainFont	   = 1,
46
    PlainFont	   = 1,
Line 2823... Line 2823...
2823
/* BBOXes are in INCHES (see MetricUnit) */
2823
/* BBOXes are in INCHES (see MetricUnit) */
2824
 
2824
 
2825
/* #ifdef'ed this function out to shut -Wall up */
2825
/* #ifdef'ed this function out to shut -Wall up */
2826
#ifdef OLD
2826
#ifdef OLD
2827
static
2827
static
2828
void GExpressionBBox(SEXP expr, int units, double *width,
2828
void GExpressionBBox(SEXP expr, GUnit units, double *width,
2829
		     double *height, double *depth, DevDesc *dd)
2829
		     double *height, double *depth, DevDesc *dd)
2830
{
2830
{
2831
    BBOX bbox;
2831
    BBOX bbox;
2832
    MathDevice = dd;
2832
    MathDevice = dd;
2833
/* The following two lines don't look right to me, but I inserted them
2833
/* The following two lines don't look right to me, but I inserted them
Line 2846... Line 2846...
2846
	*depth = GConvertYUnits(*depth, INCHES, units, dd);
2846
	*depth = GConvertYUnits(*depth, INCHES, units, dd);
2847
    }
2847
    }
2848
}
2848
}
2849
#endif
2849
#endif
2850
 
2850
 
2851
double GExpressionWidth(SEXP expr, int units, DevDesc *dd)
2851
double GExpressionWidth(SEXP expr, GUnit units, DevDesc *dd)
2852
{
2852
{
2853
    BBOX bbox;
2853
    BBOX bbox;
2854
    double width;
2854
    double width;
2855
    MathDevice = dd;
2855
    MathDevice = dd;
2856
    CurrentStyle = STYLE_D;
2856
    CurrentStyle = STYLE_D;
Line 2861... Line 2861...
2861
	return width;
2861
	return width;
2862
    else
2862
    else
2863
	return GConvertXUnits(width, INCHES, units, dd);
2863
	return GConvertXUnits(width, INCHES, units, dd);
2864
}
2864
}
2865
 
2865
 
2866
double GExpressionHeight(SEXP expr, int units, DevDesc *dd)
2866
double GExpressionHeight(SEXP expr, GUnit units, DevDesc *dd)
2867
{
2867
{
2868
    BBOX bbox;
2868
    BBOX bbox;
2869
    double height;
2869
    double height;
2870
    MathDevice = dd;
2870
    MathDevice = dd;
2871
    CurrentStyle = STYLE_D;
2871
    CurrentStyle = STYLE_D;
Line 2917... Line 2917...
2917
    CurrentAngle = rot;
2917
    CurrentAngle = rot;
2918
    rot *= M_PI_2 / 90 ;/* radians */
2918
    rot *= M_PI_2 / 90 ;/* radians */
2919
    CosAngle = cos(rot);
2919
    CosAngle = cos(rot);
2920
    SinAngle = sin(rot);
2920
    SinAngle = sin(rot);
2921
    RenderElement(expr, 1);
2921
    RenderElement(expr, 1);
2922
}
2922
}/* GMathText */
2923
 
2923
 
2924
 
2924
 
2925
void GMMathText(SEXP str, int side, double line, int outer,
2925
void GMMathText(SEXP str, int side, double line, int outer,
2926
		double at, int las, DevDesc *dd)
2926
		double at, int las, DevDesc *dd)
2927
{
2927
{
Line 2939... Line 2939...
2939
#endif
2939
#endif
2940
 
2940
 
2941
    MathDevice = dd;
2941
    MathDevice = dd;
2942
 
2942
 
2943
    if (outer) {
2943
    if (outer) {
-
 
2944
	xadj = MathDevice->gp.adj;
-
 
2945
	yadj = NA_REAL;
2944
	switch (side) {
2946
	switch (side) {
2945
	case 1:
-
 
2946
	    coords = OMA1;
2947
	case 1:	a = 0;  coords = OMA1; 	break;
2947
	    a = 0;
-
 
2948
	    xadj = MathDevice->gp.adj;
-
 
2949
	    yadj = NA_REAL;
-
 
2950
	    break;
-
 
2951
	case 2:
-
 
2952
	    coords = OMA2;
2948
	case 2:	a = 90; coords = OMA2;	break;
2953
	    a = 90;
-
 
2954
	    xadj = MathDevice->gp.adj;
-
 
2955
	    yadj = NA_REAL;
-
 
2956
	    break;
-
 
2957
	case 3:
-
 
2958
	    coords = OMA3;
2949
	case 3:	a = 0;  coords = OMA3;	break;
2959
	    a = 0.0;
-
 
2960
	    xadj = MathDevice->gp.adj;
-
 
2961
	    yadj = NA_REAL;
-
 
2962
	    break;
-
 
2963
	case 4:
-
 
2964
	    coords = OMA4;
2950
	case 4:	a = 90;	coords = OMA4;	break;
2965
	    a = 90.0;
-
 
2966
	    xadj = MathDevice->gp.adj;
-
 
2967
	    yadj = NA_REAL;
-
 
2968
	    break;
-
 
2969
	default: return;/* never happens */
2951
	default: return;/* never happens */
2970
	}
2952
	}
2971
	GMathText(at, line, coords, str, xadj, yadj, a, dd);
2953
	GMathText(at, line, coords, str, xadj, yadj, a, dd);
2972
    }
2954
    }
2973
    else {
2955
    else {
Line 3042... Line 3024...
3042
	    break;
3024
	    break;
3043
	default: return;/* never happens */
3025
	default: return;/* never happens */
3044
	}
3026
	}
3045
	GMathText(at, line, coords, str, xadj, yadj, a, dd);
3027
	GMathText(at, line, coords, str, xadj, yadj, a, dd);
3046
    }
3028
    }
3047
}
3029
}/* GMMathText */