The R Project SVN R

Rev

Rev 27680 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 27680 Rev 27683
Line 1427... Line 1427...
1427
}
1427
}
1428
 
1428
 
1429
static void SetFont(int style, int size, NewDevDesc *dd)
1429
static void SetFont(int style, int size, NewDevDesc *dd)
1430
{
1430
{
1431
    PostScriptDesc *pd = (PostScriptDesc *) dd->deviceSpecific;
1431
    PostScriptDesc *pd = (PostScriptDesc *) dd->deviceSpecific;
1432
    if(style < 1 || style > 5)
1432
    if(style < 1 || style > 5) {
-
 
1433
	warning("attempt to use invalid font %d replaced by font 1", style);
1433
	style = 1;
1434
	style = 1;
-
 
1435
    }
1434
    if(size < 1 || size > pd->maxpointsize)
1436
    if(size < 1 || size > pd->maxpointsize)
1435
	size = 10;
1437
	size = 10;
1436
    if(size != pd->current.fontsize || style != pd->current.fontstyle) {
1438
    if(size != pd->current.fontsize || style != pd->current.fontstyle) {
1437
	PostScriptSetFont(pd->psfp, style-1, size);
1439
	PostScriptSetFont(pd->psfp, style-1, size);
1438
	pd->current.fontsize = size;
1440
	pd->current.fontsize = size;
Line 2504... Line 2506...
2504
    XFigDesc *pd = (XFigDesc *) dd->deviceSpecific;
2506
    XFigDesc *pd = (XFigDesc *) dd->deviceSpecific;
2505
    FILE *fp = pd->tmpfp;
2507
    FILE *fp = pd->tmpfp;
2506
    int fontnum, style = gc->fontface;
2508
    int fontnum, style = gc->fontface;
2507
    double size = floor(gc->cex * gc->ps + 0.5);
2509
    double size = floor(gc->cex * gc->ps + 0.5);
2508
 
2510
 
2509
    if(style < 1 || style > 5) style = 1;
2511
    if(style < 1 || style > 5) {
-
 
2512
	warning("attempt to use invalid font %d replaced by font 1", style);
-
 
2513
	style = 1;
-
 
2514
    }
2510
    pd->fontsize = size;
2515
    pd->fontsize = size;
2511
    pd->fontstyle = style;
2516
    pd->fontstyle = style;
2512
    if(style == 5) fontnum = 32;
2517
    if(style == 5) fontnum = 32;
2513
    else fontnum = pd->fontnum + styles[style-1];
2518
    else fontnum = pd->fontnum + styles[style-1];
2514
 
2519
 
Line 2551... Line 2556...
2551
static double XFig_StrWidth(char *str, 
2556
static double XFig_StrWidth(char *str, 
2552
			    R_GE_gcontext *gc,
2557
			    R_GE_gcontext *gc,
2553
			    NewDevDesc *dd)
2558
			    NewDevDesc *dd)
2554
{
2559
{
2555
    XFigDesc *pd = (XFigDesc *) dd->deviceSpecific;
2560
    XFigDesc *pd = (XFigDesc *) dd->deviceSpecific;
-
 
2561
    int face = gc->fontface;
-
 
2562
 
-
 
2563
    if(face < 1 || face > 5) face = 1;
2556
 
2564
 
2557
    return floor(gc->cex * gc->ps + 0.5) *
2565
    return floor(gc->cex * gc->ps + 0.5) *
2558
	PostScriptStringWidth((unsigned char *)str,
2566
	PostScriptStringWidth((unsigned char *)str,
2559
			      &(pd->metrics[gc->fontface-1]));
2567
			      &(pd->metrics[face-1]));
2560
}
2568
}
2561
 
2569
 
2562
static void XFig_MetricInfo(int c, 
2570
static void XFig_MetricInfo(int c, 
2563
			    R_GE_gcontext *gc,
2571
			    R_GE_gcontext *gc,
2564
			    double* ascent, double* descent,
2572
			    double* ascent, double* descent,
2565
			    double* width, NewDevDesc *dd)
2573
			    double* width, NewDevDesc *dd)
2566
{
2574
{
2567
    XFigDesc *pd = (XFigDesc *) dd->deviceSpecific;
2575
    XFigDesc *pd = (XFigDesc *) dd->deviceSpecific;
-
 
2576
    int face = gc->fontface;
-
 
2577
 
-
 
2578
    if(face < 1 || face > 5) face = 1;
2568
 
2579
 
2569
    PostScriptMetricInfo(c, ascent, descent, width,
2580
    PostScriptMetricInfo(c, ascent, descent, width,
2570
			 &(pd->metrics[gc->fontface-1]));
2581
			 &(pd->metrics[face-1]));
2571
    *ascent = floor(gc->cex * gc->ps + 0.5) * *ascent;
2582
    *ascent = floor(gc->cex * gc->ps + 0.5) * *ascent;
2572
    *descent = floor(gc->cex * gc->ps + 0.5) * *descent;
2583
    *descent = floor(gc->cex * gc->ps + 0.5) * *descent;
2573
    *width = floor(gc->cex * gc->ps + 0.5) * *width;
2584
    *width = floor(gc->cex * gc->ps + 0.5) * *width;
2574
}
2585
}
2575
 
2586
 
Line 3318... Line 3329...
3318
    PDFDesc *pd = (PDFDesc *) dd->deviceSpecific;
3329
    PDFDesc *pd = (PDFDesc *) dd->deviceSpecific;
3319
    int size = (int)floor(gc->cex * gc->ps + 0.5);
3330
    int size = (int)floor(gc->cex * gc->ps + 0.5);
3320
    int face = gc->fontface;
3331
    int face = gc->fontface;
3321
    double a, b, rot1;
3332
    double a, b, rot1;
3322
 
3333
 
3323
    if(face < 1 || face > 5) face = 1;
3334
    if(face < 1 || face > 5) {
-
 
3335
	warning("attempt to use invalid font %d replaced by font 1", face);
-
 
3336
	face = 1;
-
 
3337
    }
3324
    rot1 = rot * DEG2RAD;
3338
    rot1 = rot * DEG2RAD;
3325
    a = size * cos(rot1);
3339
    a = size * cos(rot1);
3326
    b = size * sin(rot1);
3340
    b = size * sin(rot1);
3327
    if(!pd->inText) texton(pd);
3341
    if(!pd->inText) texton(pd);
3328
    if(R_ALPHA(gc->col) == 0) {
3342
    if(R_ALPHA(gc->col) == 0) {