The R Project SVN R

Rev

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

Rev 254 Rev 257
Line 2200... Line 2200...
2200
		drawFormula(expr);
2200
		drawFormula(expr);
2201
	else
2201
	else
2202
		drawAtom(expr);
2202
		drawAtom(expr);
2203
}
2203
}
2204
 
2204
 
-
 
2205
        /* calculate width of expression */
-
 
2206
        /* BBOXes are in INCHES (see metricUnit) */
-
 
2207
double GExpressionWidth(SEXP expr, int units)
-
 
2208
{
-
 
2209
        BBOX exprBBox = elementBBox(expr);
-
 
2210
        double w  = exprBBox.width;
-
 
2211
        switch(units) {
-
 
2212
                case 1: /* user == world */
-
 
2213
                        w = ((exprBBox.width / GP->ipr[0]) / GP->fig2dev.bx) / GP->win2fig.bx;
-
 
2214
                        break;
-
 
2215
                case 2: /* figure */
-
 
2216
                        w = (exprBBox.width / GP->ipr[0]) / GP->fig2dev.bx;
-
 
2217
                        break;
-
 
2218
                case 3: /* inches */
-
 
2219
                        w = exprBBox.width;
-
 
2220
                        break;
-
 
2221
                case 4: /* rasters */
-
 
2222
                        w = exprBBox.width / GP->ipr[0];
-
 
2223
                        break;
-
 
2224
        }
-
 
2225
        return w;
-
 
2226
}
-
 
2227
 
-
 
2228
#define ABS(a)  ((a)>=0 ? (a) : -(a))
-
 
2229
 
-
 
2230
double GExpressionHeight(SEXP expr, int units)
-
 
2231
{
-
 
2232
        BBOX exprBBox = elementBBox(expr);
-
 
2233
        double h = exprBBox.height + exprBBox.depth;
-
 
2234
        switch(units) {
-
 
2235
                case 1: /* user == world */
-
 
2236
                        h = ((h / GP->ipr[1]) / ABS(GP->fig2dev.by)) / GP->win2fig.by;
-
 
2237
                        break;
-
 
2238
                case 2: /* figure */
-
 
2239
                        h = (h / GP->ipr[1]) / ABS(GP->fig2dev.by);
-
 
2240
                        break;
-
 
2241
                case 3: /* inches */
-
 
2242
                        break;
-
 
2243
                case 4: /* rasters */
-
 
2244
                        h = h / GP->ipr[1];
-
 
2245
                        break;
-
 
2246
        }
-
 
2247
        return h;
-
 
2248
}
-
 
2249
 
2205
		/* functions forming the API */
2250
		/* functions forming the API */
2206
 
2251
 
2207
void GMathText(double x, double y, SEXP expr, double xc, double yc, double rot)
2252
void GMathText(double x, double y, SEXP expr, double xc, double yc, double rot)
2208
{
2253
{
2209
	BBOX expressionBBox;
2254
	BBOX expressionBBox;