diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2017-05-19 12:45:35 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2017-05-19 12:45:35 (GMT) |
commit | 59397f45e5a4819512c43d7ace8b14e1dbecc79b (patch) | |
tree | 329065a2785c3d6196bc67333bacb15c8379cce9 /generic | |
parent | 287992b11802f6db4858b4774ea45a92a734cba7 (diff) | |
parent | 3cd4896cce0f31dd0ae402a6ac1abcb18c52e03f (diff) | |
download | tk-59397f45e5a4819512c43d7ace8b14e1dbecc79b.zip tk-59397f45e5a4819512c43d7ace8b14e1dbecc79b.tar.gz tk-59397f45e5a4819512c43d7ace8b14e1dbecc79b.tar.bz2 |
Slightly use of more "int" in stead of double, for 100% compatibility at script level.
Diffstat (limited to 'generic')
-rw-r--r-- | generic/tkFont.c | 29 |
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; } |