summaryrefslogtreecommitdiffstats
path: root/generic/tkFont.c
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2017-05-19 12:45:35 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2017-05-19 12:45:35 (GMT)
commit033e66e96af33c0ea2ee90e7a6eb6a63b9424f01 (patch)
tree329065a2785c3d6196bc67333bacb15c8379cce9 /generic/tkFont.c
parent87d12d1ccc63df37fd805599bf29388c1d164e36 (diff)
parent107e2400ee9876bbfd0b4712307f642290498194 (diff)
downloadtk-033e66e96af33c0ea2ee90e7a6eb6a63b9424f01.zip
tk-033e66e96af33c0ea2ee90e7a6eb6a63b9424f01.tar.gz
tk-033e66e96af33c0ea2ee90e7a6eb6a63b9424f01.tar.bz2
Slightly use of more "int" in stead of double, for 100% compatibility at script level.bug_434d294df
Diffstat (limited to 'generic/tkFont.c')
-rw-r--r--generic/tkFont.c29
1 files changed, 14 insertions, 15 deletions
diff --git a/generic/tkFont.c b/generic/tkFont.c
index 7b6a759..2e2a5b9 100644
--- a/generic/tkFont.c
+++ b/generic/tkFont.c
@@ -1800,7 +1800,7 @@ Tk_PostscriptFontName(
}
}
- return fontPtr->fa.size;
+ return (int)(fontPtr->fa.size + 0.5);
}
/*
@@ -3375,7 +3375,6 @@ ConfigAttributesObj(
int i, n, index;
Tcl_Obj *optionPtr, *valuePtr;
const char *value;
- double d;
for (i = 0; i < objc; i += 2) {
optionPtr = objv[i];
@@ -3407,10 +3406,10 @@ ConfigAttributesObj(
faPtr->family = Tk_GetUid(value);
break;
case FONT_SIZE:
- if (Tcl_GetDoubleFromObj(interp, valuePtr, &d) != TCL_OK) {
+ if (Tcl_GetIntFromObj(interp, valuePtr, &n) != TCL_OK) {
return TCL_ERROR;
}
- faPtr->size = d;
+ faPtr->size = (double)n;
break;
case FONT_WEIGHT:
n = TkFindStateNumObj(interp, optionPtr, weightMap, valuePtr);
@@ -3651,11 +3650,10 @@ ParseFontNameObj(
faPtr->family = Tk_GetUid(Tcl_GetString(objv[0]));
if (objc > 1) {
- double d;
- if (Tcl_GetDoubleFromObj(interp, objv[1], &d) != TCL_OK) {
+ if (Tcl_GetIntFromObj(interp, objv[1], &n) != TCL_OK) {
return TCL_ERROR;
}
- faPtr->size = d;
+ faPtr->size = (double)n;
}
i = 2;
@@ -3914,9 +3912,9 @@ TkFontParseXLFD(
*/
faPtr->size = atof(field[XLFD_POINT_SIZE] + 1);
- } else if (Tcl_GetDouble(NULL, field[XLFD_POINT_SIZE],
- &faPtr->size) == TCL_OK) {
- faPtr->size /= 10;
+ } else if (Tcl_GetInt(NULL, field[XLFD_POINT_SIZE],
+ &i) == TCL_OK) {
+ faPtr->size = i/10.0;
} else {
return TCL_ERROR;
}
@@ -3939,8 +3937,9 @@ TkFontParseXLFD(
*/
faPtr->size = atof(field[XLFD_PIXEL_SIZE] + 1);
- } else if (Tcl_GetDouble(NULL, field[XLFD_PIXEL_SIZE],
- &faPtr->size) != TCL_OK) {
+ } else if (Tcl_GetInt(NULL, field[XLFD_PIXEL_SIZE],
+ &i) != TCL_OK) {
+ faPtr->size = (double)i;
return TCL_ERROR;
}
}
@@ -4019,11 +4018,11 @@ FieldSpecified(
double
TkFontGetPixels(
Tk_Window tkwin, /* For point->pixel conversion factor. */
- double size) /* Font size. */
+ double size) /* Font size. */
{
double d;
- if (size < 0) {
+ if (size <= 0.0) {
return -size;
}
@@ -4057,7 +4056,7 @@ TkFontGetPoints(
{
double d;
- if (size >= 0) {
+ if (size >= 0.0) {
return size;
}