The R Project SVN R

Rev

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

Rev 20257 Rev 21062
Line 43... Line 43...
43
static unsigned int TextColor;
43
static unsigned int TextColor;
44
/* The value of cex passed into GEMathText
44
/* The value of cex passed into GEMathText
45
 */
45
 */
46
static double BaseCex = 1;
46
static double BaseCex = 1;
47
static double MathGamma;
47
static double MathGamma;
-
 
48
static char *MathFontFamily;
48
/* The value of font passed into GEMathText
49
/* The value of font passed into GEMathText
49
 * May be modified by plotmath code -- it is plotmath code's 
50
 * May be modified by plotmath code -- it is plotmath code's 
50
 * responsibility to save and restore temporary changes.
51
 * responsibility to save and restore temporary changes.
51
 */
52
 */
52
static int MathFont;
53
static int MathFont;
-
 
54
static double MathLineHeight;
53
/* A temporary value of cex that may be modified by plotmath code.
55
/* A temporary value of cex that may be modified by plotmath code.
54
 */
56
 */
55
static double MathCex;
57
static double MathCex;
56
static double MathPs;
58
static double MathPs;
57
static GEUnit MetricUnit = GE_INCHES;
59
static GEUnit MetricUnit = GE_INCHES;
Line 126... Line 128...
126
 
128
 
127
#ifdef OLD
129
#ifdef OLD
128
static double FontHeight()
130
static double FontHeight()
129
{
131
{
130
    double height, depth, width;
132
    double height, depth, width;
-
 
133
    /* 
-
 
134
     * FIXME:  When fontfamily is passed to GEMetricInfo,
-
 
135
     * this will need updating (times many in this file)
-
 
136
     */
131
    GEMetricInfo(0, 
137
    GEMetricInfo(0, 
132
		MathFont, MathCex, MathPs,
138
		MathFont, MathCex, MathPs,
133
		&height, &depth, &width, MathDevice);
139
		&height, &depth, &width, MathDevice);
134
    return fromDeviceHeight(height + depth, MetricUnit, MathDevice);
140
    return fromDeviceHeight(height + depth, MetricUnit, MathDevice);
135
}
141
}
Line 1024... Line 1030...
1024
    bbox = GlyphBBox(ascii);
1030
    bbox = GlyphBBox(ascii);
1025
    if (draw) {
1031
    if (draw) {
1026
	asciiStr[0] = ascii;
1032
	asciiStr[0] = ascii;
1027
	asciiStr[1] = '\0';
1033
	asciiStr[1] = '\0';
1028
	GEText(ConvertedX(), ConvertedY(), asciiStr, 
1034
	GEText(ConvertedX(), ConvertedY(), asciiStr, 
1029
	      0.0, 0.0, CurrentAngle, 
1035
	       0.0, 0.0, CurrentAngle, 
-
 
1036
	       TextColor, MathGamma, 
1030
	      TextColor, MathGamma, MathFont, MathCex, MathPs,
1037
	       MathFontFamily, MathFont, MathLineHeight, MathCex, MathPs,
1031
	      MathDevice);
1038
	       MathDevice);
1032
	PMoveAcross(bboxWidth(bbox));
1039
	PMoveAcross(bboxWidth(bbox));
1033
    }
1040
    }
1034
    SetFont(prev);
1041
    SetFont(prev);
1035
    return bbox;
1042
    return bbox;
1036
}
1043
}
Line 1066... Line 1073...
1066
		bboxItalic(glyphBBox) = 0;
1073
		bboxItalic(glyphBBox) = 0;
1067
	    if (draw) {
1074
	    if (draw) {
1068
		chr[0] = *s;
1075
		chr[0] = *s;
1069
		PMoveAcross(lastItalicCorr);
1076
		PMoveAcross(lastItalicCorr);
1070
		GEText(ConvertedX(), ConvertedY(), chr,
1077
		GEText(ConvertedX(), ConvertedY(), chr,
1071
		      0.0, 0.0, CurrentAngle, 
1078
		       0.0, 0.0, CurrentAngle, 
-
 
1079
		       TextColor, MathGamma, 
1072
		      TextColor, MathGamma, MathFont, MathCex, MathPs,
1080
		       MathFontFamily, MathFont, MathLineHeight, 
-
 
1081
		       MathCex, MathPs,
1073
		      MathDevice);
1082
		       MathDevice);
1074
		PMoveAcross(bboxWidth(glyphBBox));
1083
		PMoveAcross(bboxWidth(glyphBBox));
1075
	    }
1084
	    }
1076
	    bboxWidth(resultBBox) += lastItalicCorr;
1085
	    bboxWidth(resultBBox) += lastItalicCorr;
1077
	    resultBBox = CombineBBoxes(resultBBox, glyphBBox);
1086
	    resultBBox = CombineBBoxes(resultBBox, glyphBBox);
1078
	    lastItalicCorr = bboxItalic(glyphBBox);
1087
	    lastItalicCorr = bboxItalic(glyphBBox);
Line 1094... Line 1103...
1094
    bbox = GlyphBBox(ascii);
1103
    bbox = GlyphBBox(ascii);
1095
    if (draw) {
1104
    if (draw) {
1096
	asciiStr[0] = ascii;
1105
	asciiStr[0] = ascii;
1097
	asciiStr[1] = '\0';
1106
	asciiStr[1] = '\0';
1098
	GEText(ConvertedX(), ConvertedY(), asciiStr,
1107
	GEText(ConvertedX(), ConvertedY(), asciiStr,
1099
	      0.0, 0.0, CurrentAngle, 
1108
	       0.0, 0.0, CurrentAngle, 
-
 
1109
	       TextColor, MathGamma, 
1100
	      TextColor, MathGamma, MathFont, MathCex, MathPs,
1110
	       MathFontFamily, MathFont, MathLineHeight, MathCex, MathPs,
1101
	      MathDevice);
1111
	       MathDevice);
1102
	PMoveAcross(bboxWidth(bbox));
1112
	PMoveAcross(bboxWidth(bbox));
1103
    }
1113
    }
1104
    return bbox;
1114
    return bbox;
1105
}
1115
}
1106
 
1116
 
Line 1115... Line 1125...
1115
	    resultBBox = CombineBBoxes(resultBBox, glyphBBox);
1125
	    resultBBox = CombineBBoxes(resultBBox, glyphBBox);
1116
	    s++;
1126
	    s++;
1117
	}
1127
	}
1118
	if (draw) {
1128
	if (draw) {
1119
	    GEText(ConvertedX(), ConvertedY(), str,
1129
	    GEText(ConvertedX(), ConvertedY(), str,
1120
		  0.0, 0.0, CurrentAngle, 
1130
		   0.0, 0.0, CurrentAngle, 
-
 
1131
		   TextColor, MathGamma, 
1121
		  TextColor, MathGamma, MathFont, MathCex, MathPs,
1132
		   MathFontFamily, MathFont, MathLineHeight, 
-
 
1133
		   MathCex, MathPs,
1122
		  MathDevice);
1134
		   MathDevice);
1123
	    PMoveAcross(bboxWidth(resultBBox));
1135
	    PMoveAcross(bboxWidth(resultBBox));
1124
	}
1136
	}
1125
	if (UsingItalics())
1137
	if (UsingItalics())
1126
	    bboxItalic(resultBBox) = ItalicFactor * bboxHeight(glyphBBox);
1138
	    bboxItalic(resultBBox) = ItalicFactor * bboxHeight(glyphBBox);
1127
	else
1139
	else
Line 2963... Line 2975...
2963
    MathDevice = dd;
2975
    MathDevice = dd;
2964
    BaseCex = cex;
2976
    BaseCex = cex;
2965
    BoxColor = name2col("pink");
2977
    BoxColor = name2col("pink");
2966
    TextColor = col;
2978
    TextColor = col;
2967
    MathGamma = gamma;
2979
    MathGamma = gamma;
-
 
2980
    /* 
-
 
2981
     * FIXME:  When fontfamily and lineheight are passed to GEMathText
-
 
2982
     * need to use those instead of "" and 1 below
-
 
2983
     */
-
 
2984
    MathFontFamily = "";
2968
    MathFont = font;
2985
    MathFont = font;
-
 
2986
    MathLineHeight = 1;
2969
    MathCex = cex;
2987
    MathCex = cex;
2970
    MathPs = ps;
2988
    MathPs = ps;
2971
    CurrentStyle = STYLE_D;
2989
    CurrentStyle = STYLE_D;
2972
    SetFont(PlainFont);
2990
    SetFont(PlainFont);
2973
    bbox = RenderElement(expr, 0);
2991
    bbox = RenderElement(expr, 0);