diff options
-rw-r--r-- | generic/tkFont.c | 29 | ||||
-rwxr-xr-x | unix/configure | 49 | ||||
-rw-r--r-- | unix/tkUnixFont.c | 12 | ||||
-rw-r--r-- | unix/tkUnixRFont.c | 2 | ||||
-rw-r--r-- | win/tkWinFont.c | 4 |
5 files changed, 36 insertions, 60 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; } diff --git a/unix/configure b/unix/configure index 565f915..442004d 100755 --- a/unix/configure +++ b/unix/configure @@ -5355,47 +5355,24 @@ fi OpenBSD-*) arch=`arch -s` case "$arch" in - vax) - # Equivalent using configure option --disable-load - # Step 4 will set the necessary variables - DL_OBJS="" - SHLIB_LD_LIBS="" - LDFLAGS="" + alpha|sparc64) + SHLIB_CFLAGS="-fPIC" ;; *) - case "$arch" in - alpha|sparc|sparc64) - SHLIB_CFLAGS="-fPIC" - ;; - *) - SHLIB_CFLAGS="-fpic" - ;; - esac - SHLIB_LD='${CC} -shared ${SHLIB_CFLAGS}' - SHLIB_SUFFIX=".so" - DL_OBJS="tclLoadDl.o" - DL_LIBS="" - if test $doRpath = yes; then + SHLIB_CFLAGS="-fpic" + ;; + esac + SHLIB_LD='${CC} -shared ${SHLIB_CFLAGS}' + SHLIB_SUFFIX=".so" + if test $doRpath = yes; then - CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' + CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' fi - LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} - SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so.${SHLIB_VERSION}' - LDFLAGS="-Wl,-export-dynamic" - ;; - esac - case "$arch" in - vax) - CFLAGS_OPTIMIZE="-O1" - ;; - sh) - CFLAGS_OPTIMIZE="-O0" - ;; - *) - CFLAGS_OPTIMIZE="-O2" - ;; - esac + LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} + SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so${SHLIB_VERSION}' + LDFLAGS="-Wl,-export-dynamic" + CFLAGS_OPTIMIZE="-O2" if test "${TCL_THREADS}" = "1"; then # On OpenBSD: Compile with -pthread diff --git a/unix/tkUnixFont.c b/unix/tkUnixFont.c index e2ce2bc..b361e83 100644 --- a/unix/tkUnixFont.c +++ b/unix/tkUnixFont.c @@ -1535,7 +1535,7 @@ CreateClosestFont( continue; } IdentifySymbolEncodings(&got); - scalable = (got.fa.size == 0); + scalable = (got.fa.size == 0.0); score = RankAttributes(&want, &got); if (score < bestScore[scalable]) { bestIdx[scalable] = nameIdx; @@ -2453,7 +2453,7 @@ CanUseFallback( want.xa = fontPtr->xa; want.fa.family = Tk_GetUid(faceName); - want.fa.size = -fontPtr->pixelSize; + want.fa.size = (double)-fontPtr->pixelSize; hateFoundry = NULL; hateCharset = NULL; @@ -2536,7 +2536,7 @@ CanUseFallback( * D. Rank each name and pick the best match. */ - scalable = (got.fa.size == 0); + scalable = (got.fa.size == 0.0); score = RankAttributes(&want, &got); if (score < bestScore[scalable]) { bestIdx[scalable] = nameIdx; @@ -2665,7 +2665,7 @@ RankAttributes( penalty += 1000; } - if (gotPtr->fa.size == 0) { + if (gotPtr->fa.size == 0.0) { /* * A scalable font is almost always acceptable, but the corresponding * bitmapped font would be better. @@ -2679,14 +2679,14 @@ RankAttributes( * It's worse to be too large than to be too small. */ - diff = (-gotPtr->fa.size - -wantPtr->fa.size); + diff = (int) (150 * (-gotPtr->fa.size - -wantPtr->fa.size)); if (diff > 0) { penalty += 600; } else if (diff < 0) { penalty += 150; diff = -diff; } - penalty += 150 * diff; + penalty += diff; } if (gotPtr->xa.charset != wantPtr->xa.charset) { int i; diff --git a/unix/tkUnixRFont.c b/unix/tkUnixRFont.c index b818a70..a08b95f 100644 --- a/unix/tkUnixRFont.c +++ b/unix/tkUnixRFont.c @@ -182,7 +182,7 @@ GetTkFontAttributes( size = -ptsize; } else if (XftPatternGetInteger(ftFont->pattern, XFT_PIXEL_SIZE, 0, &pxsize) == XftResultMatch) { - size = -pxsize; + size = (double)-pxsize; } else { size = 12.0; } diff --git a/win/tkWinFont.c b/win/tkWinFont.c index b7b0bec..d67ea66 100644 --- a/win/tkWinFont.c +++ b/win/tkWinFont.c @@ -763,7 +763,7 @@ TkpGetFontAttrsForChar( ReleaseDC(fontPtr->hwnd, hdc); faPtr->family = familyPtr->faceName; faPtr->size = TkFontGetPoints(tkwin, - tm.tmInternalLeading - tm.tmHeight); + (double)(tm.tmInternalLeading - tm.tmHeight)); faPtr->weight = (tm.tmWeight > FW_MEDIUM) ? TK_FW_BOLD : TK_FW_NORMAL; faPtr->slant = tm.tmItalic ? TK_FS_ITALIC : TK_FS_ROMAN; faPtr->underline = (tm.tmUnderlined != 0); @@ -1600,7 +1600,7 @@ InitFont( faPtr->family = Tk_GetUid(Tcl_DStringValue(&faceString)); faPtr->size = - TkFontGetPoints(tkwin, -(fontPtr->pixelSize)); + TkFontGetPoints(tkwin, (double)-(fontPtr->pixelSize)); faPtr->weight = (tm.tmWeight > FW_MEDIUM) ? TK_FW_BOLD : TK_FW_NORMAL; faPtr->slant = (tm.tmItalic != 0) ? TK_FS_ITALIC : TK_FS_ROMAN; |