diff options
author | dgp <dgp@users.sourceforge.net> | 2017-05-23 14:58:41 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2017-05-23 14:58:41 (GMT) |
commit | 73b7effc31ec76c6f682fa75ab4bcac6b50e6955 (patch) | |
tree | 1c61ff85f43477826b2500c1f7533f3cffcdf137 | |
parent | 56f4a0d0fc8d1566198a423a888e16aa5336c08e (diff) | |
parent | ce84448c05bb61135f0cebd1a812f3e4496f62bd (diff) | |
download | tk-73b7effc31ec76c6f682fa75ab4bcac6b50e6955.zip tk-73b7effc31ec76c6f682fa75ab4bcac6b50e6955.tar.gz tk-73b7effc31ec76c6f682fa75ab4bcac6b50e6955.tar.bz2 |
merge 8.6
-rw-r--r-- | generic/tkCanvPs.c | 2 | ||||
-rw-r--r-- | generic/tkFont.c | 44 | ||||
-rw-r--r-- | generic/tkFont.h | 6 | ||||
-rw-r--r-- | generic/tkTextDisp.c | 4 | ||||
-rw-r--r-- | macosx/tkMacOSXDialog.c | 50 | ||||
-rw-r--r-- | macosx/tkMacOSXFont.c | 2 | ||||
-rwxr-xr-x | unix/configure | 62 | ||||
-rw-r--r-- | unix/tcl.m4 | 60 | ||||
-rw-r--r-- | unix/tkUnixButton.c | 81 | ||||
-rw-r--r-- | unix/tkUnixFont.c | 16 | ||||
-rw-r--r-- | unix/tkUnixRFont.c | 23 | ||||
-rw-r--r-- | win/tkWinDialog.c | 4 | ||||
-rw-r--r-- | win/tkWinFont.c | 6 |
13 files changed, 168 insertions, 192 deletions
diff --git a/generic/tkCanvPs.c b/generic/tkCanvPs.c index c6470dd..2bfdcc5 100644 --- a/generic/tkCanvPs.c +++ b/generic/tkCanvPs.c @@ -825,7 +825,7 @@ Tk_PostscriptFont( fontname = Tcl_DStringValue(&ds); Tcl_AppendPrintfToObj(GetPostscriptBuffer(interp), "/%s findfont %d scalefont%s setfont\n", - fontname, TkFontGetPoints(psInfoPtr->tkwin, points), + fontname, (int)(TkFontGetPoints(psInfoPtr->tkwin, points) + 0.5), strncasecmp(fontname, "Symbol", 7) ? " ISOEncode" : ""); Tcl_CreateHashEntry(&psInfoPtr->fontTable, Tcl_DStringValue(&ds), &i); Tcl_DStringFree(&ds); diff --git a/generic/tkFont.c b/generic/tkFont.c index bec8807..4183686 100644 --- a/generic/tkFont.c +++ b/generic/tkFont.c @@ -1228,7 +1228,7 @@ Tk_AllocFontFromObj( descent = fontPtr->fm.descent; fontPtr->underlinePos = descent / 2; - fontPtr->underlineHeight = TkFontGetPixels(tkwin, fontPtr->fa.size) / 10; + fontPtr->underlineHeight = (int) (TkFontGetPixels(tkwin, fontPtr->fa.size) / 10 + 0.5); if (fontPtr->underlineHeight == 0) { fontPtr->underlineHeight = 1; } @@ -1800,7 +1800,7 @@ Tk_PostscriptFontName( } } - return fontPtr->fa.size; + return (int)(fontPtr->fa.size + 0.5); } /* @@ -3409,7 +3409,7 @@ ConfigAttributesObj( if (Tcl_GetIntFromObj(interp, valuePtr, &n) != TCL_OK) { return TCL_ERROR; } - faPtr->size = n; + faPtr->size = (double)n; break; case FONT_WEIGHT: n = TkFindStateNumObj(interp, optionPtr, weightMap, valuePtr); @@ -3500,7 +3500,11 @@ GetAttributeInfoObj( break; case FONT_SIZE: - valuePtr = Tcl_NewIntObj(faPtr->size); + if (faPtr->size >= 0.0) { + valuePtr = Tcl_NewIntObj((int)(faPtr->size + 0.5)); + } else { + valuePtr = Tcl_NewIntObj(-(int)(-faPtr->size + 0.5)); + } break; case FONT_WEIGHT: @@ -3649,7 +3653,7 @@ ParseFontNameObj( if (Tcl_GetIntFromObj(interp, objv[1], &n) != TCL_OK) { return TCL_ERROR; } - faPtr->size = n; + faPtr->size = (double)n; } i = 2; @@ -3893,7 +3897,7 @@ TkFontParseXLFD( * historical compatibility. */ - faPtr->size = 12; + faPtr->size = 12.0; if (FieldSpecified(field[XLFD_POINT_SIZE])) { if (field[XLFD_POINT_SIZE][0] == '[') { @@ -3907,10 +3911,10 @@ TkFontParseXLFD( * the purpose of, so I ignore them. */ - faPtr->size = atoi(field[XLFD_POINT_SIZE] + 1); + faPtr->size = atof(field[XLFD_POINT_SIZE] + 1); } else if (Tcl_GetInt(NULL, field[XLFD_POINT_SIZE], - &faPtr->size) == TCL_OK) { - faPtr->size /= 10; + &i) == TCL_OK) { + faPtr->size = i/10.0; } else { return TCL_ERROR; } @@ -3932,9 +3936,11 @@ TkFontParseXLFD( * ignore them. */ - faPtr->size = atoi(field[XLFD_PIXEL_SIZE] + 1); + faPtr->size = atof(field[XLFD_PIXEL_SIZE] + 1); } else if (Tcl_GetInt(NULL, field[XLFD_PIXEL_SIZE], - &faPtr->size) != TCL_OK) { + &i) == TCL_OK) { + faPtr->size = (double)i; + } else { return TCL_ERROR; } } @@ -4010,21 +4016,21 @@ FieldSpecified( *--------------------------------------------------------------------------- */ -int +double TkFontGetPixels( Tk_Window tkwin, /* For point->pixel conversion factor. */ - int size) /* Font size. */ + double size) /* Font size. */ { double d; - if (size < 0) { + if (size <= 0.0) { return -size; } d = size * 25.4 / 72.0; d *= WidthOfScreen(Tk_Screen(tkwin)); d /= WidthMMOfScreen(Tk_Screen(tkwin)); - return (int) (d + 0.5); + return d; } /* @@ -4044,21 +4050,21 @@ TkFontGetPixels( *--------------------------------------------------------------------------- */ -int +double TkFontGetPoints( Tk_Window tkwin, /* For pixel->point conversion factor. */ - int size) /* Font size. */ + double size) /* Font size. */ { double d; - if (size >= 0) { + if (size >= 0.0) { return size; } d = -size * 72.0 / 25.4; d *= WidthMMOfScreen(Tk_Screen(tkwin)); d /= WidthOfScreen(Tk_Screen(tkwin)); - return (int) (d + 0.5); + return d; } /* diff --git a/generic/tkFont.h b/generic/tkFont.h index b8de885..de479bf 100644 --- a/generic/tkFont.h +++ b/generic/tkFont.h @@ -23,7 +23,7 @@ struct TkFontAttributes { Tk_Uid family; /* Font family, or NULL to represent plaform- * specific default system font. */ - int size; /* Pointsize of font, 0 for default size, or + double size; /* Pointsize of font, 0.0 for default size, or * negative number meaning pixel size. */ int weight; /* Weight flag; see below for def'n. */ int slant; /* Slant flag; see below for def'n. */ @@ -198,8 +198,8 @@ MODULE_SCOPE int TkFontParseXLFD(const char *string, TkFontAttributes *faPtr, TkXLFDAttributes *xaPtr); MODULE_SCOPE const char *const * TkFontGetAliasList(const char *faceName); MODULE_SCOPE const char *const *const * TkFontGetFallbacks(void); -MODULE_SCOPE int TkFontGetPixels(Tk_Window tkwin, int size); -MODULE_SCOPE int TkFontGetPoints(Tk_Window tkwin, int size); +MODULE_SCOPE double TkFontGetPixels(Tk_Window tkwin, double size); +MODULE_SCOPE double TkFontGetPoints(Tk_Window tkwin, double size); MODULE_SCOPE const char *const * TkFontGetGlobalClass(void); MODULE_SCOPE const char *const * TkFontGetSymbolClass(void); MODULE_SCOPE int TkCreateNamedFont(Tcl_Interp *interp, Tk_Window tkwin, diff --git a/generic/tkTextDisp.c b/generic/tkTextDisp.c index 371e910..9c2f536 100644 --- a/generic/tkTextDisp.c +++ b/generic/tkTextDisp.c @@ -8981,13 +8981,13 @@ RemoveFromBaseChunk( bciPtr = baseCharChunkPtr->clientData; +#ifdef DEBUG_LAYOUT_WITH_BASE_CHUNKS if ((ciPtr->baseOffset + ciPtr->numBytes) != Tcl_DStringLength(&bciPtr->baseChars)) { -#ifdef DEBUG_LAYOUT_WITH_BASE_CHUNKS fprintf(stderr,"RemoveFromBaseChunk called with wrong chunk " "(not last)\n"); -#endif } +#endif Tcl_DStringSetLength(&bciPtr->baseChars, ciPtr->baseOffset); diff --git a/macosx/tkMacOSXDialog.c b/macosx/tkMacOSXDialog.c index 2670b32..027a8e4 100644 --- a/macosx/tkMacOSXDialog.c +++ b/macosx/tkMacOSXDialog.c @@ -6,7 +6,7 @@ * Copyright (c) 1996-1997 Sun Microsystems, Inc. * Copyright 2001-2009, Apple Inc. * Copyright (c) 2006-2009 Daniel A. Steffen <das@users.sourceforge.net> - * Copyright (c) 2017 Christian Gollwitzer. + * Copyright (c) 2017 Christian Gollwitzer. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. @@ -34,7 +34,7 @@ typedef struct { NSMutableArray *fileTypeExtensions; // array of allowed extensions per name, e.g. "txt", "doc" NSMutableArray *fileTypeLabels; // displayed string, e.g. "Text document (.txt, .doc)" NSMutableArray *allAllowedExtensions; // set of all allowed extensions - NSInteger fileTypeIndex; // index of currently selected filter + NSInteger fileTypeIndex; // index of currently selected filter } filepanelFilterInfo; filepanelFilterInfo filterInfo; @@ -413,7 +413,7 @@ int parseFileFilters(Tcl_Interp *interp, Tcl_Obj *fileTypesPtr, Tcl_Obj *typeVar } filterInfo.doFileTypes = (fl.filters != NULL); - + filterInfo.fileTypeIndex = 0; filterInfo.fileTypeExtensions = [NSMutableArray array]; filterInfo.fileTypeNames = [NSMutableArray array]; @@ -442,7 +442,7 @@ int parseFileFilters(Tcl_Interp *interp, Tcl_Obj *fileTypesPtr, Tcl_Obj *typeVar if (![filterInfo.allAllowedExtensions containsObject:extension]) { [filterInfo.allAllowedExtensions addObject:extension]; } - + [clauseextensions addObject:extension]; [displayextensions addObject:[@"." stringByAppendingString:extension]]; @@ -458,7 +458,7 @@ int parseFileFilters(Tcl_Interp *interp, Tcl_Obj *fileTypesPtr, Tcl_Obj *typeVar [label appendString:@")"]; [filterInfo.fileTypeLabels addObject:label]; [label release]; - + } /* Check if the typevariable exists and matches one of the names */ @@ -467,21 +467,21 @@ int parseFileFilters(Tcl_Interp *interp, Tcl_Obj *fileTypesPtr, Tcl_Obj *typeVar if (typeVariablePtr) { /* extract the variable content as a NSString */ Tcl_Obj *selectedFileTypeObj = Tcl_ObjGetVar2(interp, typeVariablePtr, NULL, TCL_GLOBAL_ONLY); - + /* check that the typevariable exists */ - if (selectedFileTypeObj != NULL) { + if (selectedFileTypeObj != NULL) { const char *selectedFileType = Tcl_GetString(selectedFileTypeObj); NSString *selectedFileTypeStr = [[NSString alloc] initWithUTF8String:selectedFileType]; NSUInteger index = [filterInfo.fileTypeNames indexOfObject:selectedFileTypeStr]; - + if (index != NSNotFound) { filterInfo.fileTypeIndex = index; filterInfo.preselectFilter = true; } } - } + } - } + } TkFreeFileFilters(&fl); return TCL_OK; @@ -587,9 +587,9 @@ Tk_GetOpenFileObjCmd( break; } } - - /* From OSX 10.11, the title string is silently ignored. - * Prepend the title to the message + + /* From OSX 10.11, the title string is silently ignored. + * Prepend the title to the message * NOTE should be conditional on OSX version, but * -mmacosx-version-min does not revert this behaviour*/ if (title) { @@ -610,7 +610,7 @@ Tk_GetOpenFileObjCmd( } [openpanel setAllowsMultipleSelection:multiple]; - + if (parseFileFilters(interp, fileTypesPtr, typeVariablePtr) != TCL_OK) { goto end; } @@ -630,19 +630,19 @@ Tk_GetOpenFileObjCmd( [accessoryView addSubview:label]; [accessoryView addSubview:popupButton]; - + if (filterInfo.preselectFilter) { - /* A specific filter was selected from the typevariable. Select it and + /* A specific filter was selected from the typevariable. Select it and * open the accessory view */ [popupButton selectItemAtIndex:filterInfo.fileTypeIndex]; - /* on OSX > 10.11, the optons are not visible by default. Ergo allow all file types + /* on OSX > 10.11, the optons are not visible by default. Ergo allow all file types [openpanel setAllowedFileTypes:filterInfo.fileTypeExtensions[filterInfo.fileTypeIndex]]; */ [openpanel setAllowedFileTypes:filterInfo.allAllowedExtensions]; } else { [openpanel setAllowedFileTypes:filterInfo.allAllowedExtensions]; } - + [openpanel setAllowsOtherFileTypes:NO]; [openpanel setAccessoryView:accessoryView]; @@ -658,7 +658,7 @@ Tk_GetOpenFileObjCmd( } Tcl_IncrRefCount(cmdObj); } - + callbackInfo->cmdObj = cmdObj; callbackInfo->interp = interp; callbackInfo->multiple = multiple; @@ -698,8 +698,8 @@ Tk_GetOpenFileObjCmd( if (parentIsKey) { [parent makeKeyWindow]; } - - if ((typeVariablePtr && (modalReturnCode == NSOKButton)) && + + if ((typeVariablePtr && (modalReturnCode == NSOKButton)) && filterInfo.doFileTypes && filterInfo.userHasSelectedFilter) { /* * The -typevariable must be set to the selected file type, if the dialog was not cancelled @@ -712,7 +712,7 @@ Tk_GetOpenFileObjCmd( Tcl_NewStringObj([selectedFilter UTF8String], -1), TCL_GLOBAL_ONLY); } - + end: return result; } @@ -826,7 +826,7 @@ Tk_GetSaveFileObjCmd( break; } } - + if (title) { [savepanel setTitle:title]; if (message) { @@ -866,7 +866,7 @@ Tk_GetSaveFileObjCmd( [accessoryView addSubview:popupButton]; [savepanel setAccessoryView:accessoryView]; - + [savepanel setAllowedFileTypes:filterInfo.fileTypeExtensions[filterInfo.fileTypeIndex]]; [savepanel setAllowsOtherFileTypes:NO]; } else if (defaultType) { @@ -930,7 +930,7 @@ Tk_GetSaveFileObjCmd( if (parentIsKey) { [parent makeKeyWindow]; } - + if ((typeVariablePtr && (modalReturnCode == NSOKButton)) && filterInfo.doFileTypes) { /* * The -typevariable must be set to the selected file type, if the dialog was not cancelled diff --git a/macosx/tkMacOSXFont.c b/macosx/tkMacOSXFont.c index b5ae1a3..fd4c19a 100644 --- a/macosx/tkMacOSXFont.c +++ b/macosx/tkMacOSXFont.c @@ -515,7 +515,7 @@ TkpGetFontFromAttributes( /* Set of attributes to match. */ { MacFont *fontPtr; - int points = TkFontGetPoints(tkwin, faPtr->size); + int points = (int)(TkFontGetPoints(tkwin, faPtr->size) + 0.5); NSFontTraitMask traits = GetNSFontTraitsFromTkFontAttributes(faPtr); NSInteger weight = (faPtr->weight == TK_FW_BOLD ? 9 : 5); NSFont *nsFont; diff --git a/unix/configure b/unix/configure index be81f66..a8cb060 100755 --- a/unix/configure +++ b/unix/configure @@ -1429,8 +1429,9 @@ echo "$as_me: error: ${with_tclconfig} directory doesn't contain tclConfig.sh" > for i in `ls -d ${libdir} 2>/dev/null` \ `ls -d ${exec_prefix}/lib 2>/dev/null` \ `ls -d ${prefix}/lib 2>/dev/null` \ - `ls -d /usr/local/lib 2>/dev/null` \ `ls -d /usr/contrib/lib 2>/dev/null` \ + `ls -d /usr/local/lib 2>/dev/null` \ + `ls -d /usr/pkg/lib 2>/dev/null` \ `ls -d /usr/lib 2>/dev/null` \ `ls -d /usr/lib64 2>/dev/null` \ ; do @@ -4489,8 +4490,10 @@ fi PLAT_OBJS="" PLAT_SRCS="" LDAIX_SRC="" - if test x"${SHLIB_VERSION}" = x; then - SHLIB_VERSION="1.0" + if test "x${SHLIB_VERSION}" = x; then + SHLIB_VERSION=".1.0" +else + SHLIB_VERSION=".${SHLIB_VERSION}" fi case $system in @@ -5355,47 +5358,26 @@ 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" + DL_OBJS="tclLoadDl.o" + DL_LIBS="" + 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 @@ -6134,7 +6116,7 @@ fi # requires an extra version number at the end of .so file names. # So, the library has to have a name like libtcl75.so.1.0 - SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so.${SHLIB_VERSION}' + SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so${SHLIB_VERSION}' UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a' TCL_LIB_VERSIONS_OK=nodots ;; diff --git a/unix/tcl.m4 b/unix/tcl.m4 index 41b94ef..8a802fb 100644 --- a/unix/tcl.m4 +++ b/unix/tcl.m4 @@ -91,8 +91,9 @@ AC_DEFUN([SC_PATH_TCLCONFIG], [ for i in `ls -d ${libdir} 2>/dev/null` \ `ls -d ${exec_prefix}/lib 2>/dev/null` \ `ls -d ${prefix}/lib 2>/dev/null` \ - `ls -d /usr/local/lib 2>/dev/null` \ `ls -d /usr/contrib/lib 2>/dev/null` \ + `ls -d /usr/local/lib 2>/dev/null` \ + `ls -d /usr/pkg/lib 2>/dev/null` \ `ls -d /usr/lib 2>/dev/null` \ `ls -d /usr/lib64 2>/dev/null` \ ; do @@ -611,7 +612,6 @@ AC_DEFUN([SC_ENABLE_FRAMEWORK], [ # TCL_THREADS # _REENTRANT # _THREAD_SAFE -# #------------------------------------------------------------------------ AC_DEFUN([SC_ENABLE_THREADS], [ @@ -727,7 +727,6 @@ AC_DEFUN([SC_ENABLE_THREADS], [ # Sets to $(LDFLAGS_OPTIMIZE) if false # DBGX Formerly used as debug library extension; # always blank now. -# #------------------------------------------------------------------------ AC_DEFUN([SC_ENABLE_SYMBOLS], [ @@ -977,7 +976,7 @@ AC_DEFUN([SC_CONFIG_SYSTEM], [ # SHLIB_LD_LIBS - Dependent libraries for the linker to scan when # creating shared libraries. This symbol typically # goes at the end of the "ld" commands that build -# shared libraries. The value of the symbol is +# shared libraries. The value of the symbol defaults to # "${LIBS}" if all of the dependent libraries should # be specified when creating a shared library. If # dependent libraries should not be specified (as on @@ -1107,7 +1106,7 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [ PLAT_OBJS="" PLAT_SRCS="" LDAIX_SRC="" - AS_IF([test x"${SHLIB_VERSION}" = x], [SHLIB_VERSION="1.0"]) + AS_IF([test "x${SHLIB_VERSION}" = x],[SHLIB_VERSION=".1.0"],[SHLIB_VERSION=".${SHLIB_VERSION}"]) case $system in AIX-*) AS_IF([test "${TCL_THREADS}" = "1" -a "$GCC" != "yes"], [ @@ -1467,44 +1466,23 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [ 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="" - AS_IF([test $doRpath = yes], [ - CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}']) - 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" + SHLIB_CFLAGS="-fpic" ;; esac + SHLIB_LD='${CC} -shared ${SHLIB_CFLAGS}' + SHLIB_SUFFIX=".so" + DL_OBJS="tclLoadDl.o" + DL_LIBS="" + AS_IF([test $doRpath = yes], [ + CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}']) + LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} + SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so${SHLIB_VERSION}' + LDFLAGS="-Wl,-export-dynamic" + CFLAGS_OPTIMIZE="-O2" AS_IF([test "${TCL_THREADS}" = "1"], [ # On OpenBSD: Compile with -pthread # Don't link with -lpthread @@ -1825,7 +1803,7 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [ # requires an extra version number at the end of .so file names. # So, the library has to have a name like libtcl75.so.1.0 - SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so.${SHLIB_VERSION}' + SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so${SHLIB_VERSION}' UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a' TCL_LIB_VERSIONS_OK=nodots ;; @@ -2706,7 +2684,7 @@ AC_DEFUN([SC_TCL_CFG_ENCODING], [ # advancedTest - the advanced test to run if the function is present # # Results: -# Might cause compatability versions of the function to be used. +# Might cause compatibility versions of the function to be used. # Might affect the following vars: # USE_COMPAT (implicit) # diff --git a/unix/tkUnixButton.c b/unix/tkUnixButton.c index 1aeefac..6a99124 100644 --- a/unix/tkUnixButton.c +++ b/unix/tkUnixButton.c @@ -351,6 +351,47 @@ TkpCreateButton( *---------------------------------------------------------------------- */ +static void +ShiftByOffset( + TkButton *butPtr, + int relief, + int *x, /* shift this x coordinate */ + int *y, /* shift this y coordinate */ + int width, /* width of image/text */ + int height) /* height of image/text */ +{ + if (relief != TK_RELIEF_RAISED + && butPtr->type == TYPE_BUTTON + && !Tk_StrictMotif(butPtr->tkwin)) { + int shiftX; + int shiftY; + + /* + * This is an (unraised) button widget, so we offset the text to make + * the button appear to move up and down as the relief changes. + */ + + shiftX = shiftY = (relief == TK_RELIEF_SUNKEN) ? 2 : 1; + + if (relief != TK_RELIEF_RIDGE) { + /* + * Take back one pixel if the padding is even, otherwise the + * content will be displayed too far right/down. + */ + + if ((Tk_Width(butPtr->tkwin) - width) % 2 == 0) { + shiftX -= 1; + } + if ((Tk_Height(butPtr->tkwin) - height) % 2 == 0) { + shiftY -= 1; + } + } + + *x += shiftX; + *y += shiftY; + } +} + void TkpDisplayButton( ClientData clientData) /* Information about widget. */ @@ -366,10 +407,6 @@ TkpDisplayButton( int width = 0, height = 0, fullWidth, fullHeight; int textXOffset, textYOffset; int haveImage = 0, haveText = 0; - int offset; /* 1 means this is a button widget, so we - * offset the text to make the button appear - * to move up and down as the relief - * changes. */ int imageWidth, imageHeight; int imageXOffset = 0, imageYOffset = 0; /* image information that will be used to @@ -432,8 +469,6 @@ TkpDisplayButton( } } - offset = (butPtr->type == TYPE_BUTTON) && !Tk_StrictMotif(butPtr->tkwin); - /* * In order to avoid screen flashes, this function redraws the button in a * pixmap, then copies the pixmap to the screen in a single operation. @@ -525,17 +560,7 @@ TkpDisplayButton( butPtr->indicatorSpace + fullWidth, fullHeight, &x, &y); x += butPtr->indicatorSpace; - - x += offset; - y += offset; - if (relief == TK_RELIEF_RAISED) { - x -= offset; - y -= offset; - } else if (relief == TK_RELIEF_SUNKEN) { - x += offset; - y += offset; - } - + ShiftByOffset(butPtr, relief, &x, &y, width, height); imageXOffset += x; imageYOffset += y; @@ -593,16 +618,7 @@ TkpDisplayButton( TkComputeAnchor(butPtr->anchor, tkwin, 0, 0, butPtr->indicatorSpace + width, height, &x, &y); x += butPtr->indicatorSpace; - - x += offset; - y += offset; - if (relief == TK_RELIEF_RAISED) { - x -= offset; - y -= offset; - } else if (relief == TK_RELIEF_SUNKEN) { - x += offset; - y += offset; - } + ShiftByOffset(butPtr, relief, &x, &y, width, height); imageXOffset += x; imageYOffset += y; if (butPtr->image != NULL) { @@ -655,16 +671,7 @@ TkpDisplayButton( butPtr->textHeight, &x, &y); x += butPtr->indicatorSpace; - - x += offset; - y += offset; - if (relief == TK_RELIEF_RAISED) { - x -= offset; - y -= offset; - } else if (relief == TK_RELIEF_SUNKEN) { - x += offset; - y += offset; - } + ShiftByOffset(butPtr, relief, &x, &y, width, height); Tk_DrawTextLayout(butPtr->display, pixmap, gc, butPtr->textLayout, x, y, 0, -1); Tk_UnderlineTextLayout(butPtr->display, pixmap, gc, diff --git a/unix/tkUnixFont.c b/unix/tkUnixFont.c index 0c663a3..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; @@ -1642,7 +1642,7 @@ InitFont( fmPtr->fixed = fixed; fontPtr->display = display; - fontPtr->pixelSize = TkFontGetPixels(tkwin, fa.fa.size); + fontPtr->pixelSize = (int)(TkFontGetPixels(tkwin, fa.fa.size) + 0.5); fontPtr->xa = fa.xa; fontPtr->numSubFonts = 1; @@ -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; @@ -2773,7 +2773,7 @@ GetScreenFont( } *str = '\0'; sprintf(buf, "%.200s-%d-*-*-*-*-*%s", nameList[bestIdx[1]], - -wantPtr->fa.size, rest); + (int)(-wantPtr->fa.size+0.5), rest); *str = '-'; fontStructPtr = XLoadQueryFont(display, buf); bestScore[1] = INT_MAX; diff --git a/unix/tkUnixRFont.c b/unix/tkUnixRFont.c index 41cd096..cce59a8 100644 --- a/unix/tkUnixRFont.c +++ b/unix/tkUnixRFont.c @@ -170,18 +170,21 @@ GetTkFontAttributes( { const char *family = "Unknown"; const char *const *familyPtr = &family; - int weight, slant, size, pxsize; - double ptsize; + int weight, slant, pxsize; + double size, ptsize; (void) XftPatternGetString(ftFont->pattern, XFT_FAMILY, 0, familyPtr); if (XftPatternGetDouble(ftFont->pattern, XFT_SIZE, 0, &ptsize) == XftResultMatch) { - size = (int) ptsize; + size = ptsize; + } else if (XftPatternGetDouble(ftFont->pattern, XFT_PIXEL_SIZE, 0, + &ptsize) == XftResultMatch) { + size = -ptsize; } else if (XftPatternGetInteger(ftFont->pattern, XFT_PIXEL_SIZE, 0, &pxsize) == XftResultMatch) { - size = -pxsize; + size = (double)-pxsize; } else { - size = 12; + size = 12.0; } if (XftPatternGetInteger(ftFont->pattern, XFT_WEIGHT, 0, &weight) != XftResultMatch) { @@ -194,7 +197,7 @@ GetTkFontAttributes( #if DEBUG_FONTSEL printf("family %s size %d weight %d slant %d\n", - family, size, weight, slant); + family, (int)size, weight, slant); #endif /* DEBUG_FONTSEL */ faPtr->family = Tk_GetUid(family); @@ -441,10 +444,10 @@ TkpGetFontFromAttributes( if (faPtr->family) { XftPatternAddString(pattern, XFT_FAMILY, faPtr->family); } - if (faPtr->size > 0) { - XftPatternAddDouble(pattern, XFT_SIZE, (double)faPtr->size); - } else if (faPtr->size < 0) { - XftPatternAddInteger(pattern, XFT_PIXEL_SIZE, -faPtr->size); + if (faPtr->size > 0.0) { + XftPatternAddDouble(pattern, XFT_SIZE, faPtr->size); + } else if (faPtr->size < 0.0) { + XftPatternAddDouble(pattern, XFT_SIZE, TkFontGetPoints(tkwin, faPtr->size)); } else { XftPatternAddDouble(pattern, XFT_SIZE, 12.0); } diff --git a/win/tkWinDialog.c b/win/tkWinDialog.c index 635b9a3..5be6776 100644 --- a/win/tkWinDialog.c +++ b/win/tkWinDialog.c @@ -2808,7 +2808,7 @@ Tk_MessageBoxObjCmd( ThreadSpecificData *tsdPtr = Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); Tcl_DString titleBuf, tmpBuf; - WCHAR *titlePtr, *tmpPtr; + const WCHAR *titlePtr, *tmpPtr; const char *src; defaultBtn = -1; @@ -3487,7 +3487,7 @@ FontchooserShowCmd( LF_FACESIZE-1); Tcl_DStringFree(&ds); lf.lfFaceName[LF_FACESIZE-1] = 0; - lf.lfHeight = -MulDiv(TkFontGetPoints(tkwin, fontPtr->fa.size), + lf.lfHeight = -MulDiv((int)(TkFontGetPoints(tkwin, fontPtr->fa.size) + 0.5), GetDeviceCaps(hdc, LOGPIXELSY), 72); if (fontPtr->fa.weight == TK_FW_BOLD) { lf.lfWeight = FW_BOLD; diff --git a/win/tkWinFont.c b/win/tkWinFont.c index f342f7c..d67ea66 100644 --- a/win/tkWinFont.c +++ b/win/tkWinFont.c @@ -562,7 +562,7 @@ TkpGetFontFromAttributes( ReleaseDC(hwnd, hdc); hFont = GetScreenFont(faPtr, faceName, - TkFontGetPixels(tkwin, faPtr->size), 0.0); + (int)(TkFontGetPixels(tkwin, faPtr->size) + 0.5), 0.0); if (tkFontPtr == NULL) { fontPtr = ckalloc(sizeof(WinFont)); } else { @@ -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; |