summaryrefslogtreecommitdiffstats
path: root/win
diff options
context:
space:
mode:
Diffstat (limited to 'win')
-rw-r--r--win/tkWinDialog.c6
-rw-r--r--win/tkWinFont.c12
-rw-r--r--win/tkWinInit.c4
-rw-r--r--win/tkWinInt.h8
4 files changed, 17 insertions, 13 deletions
diff --git a/win/tkWinDialog.c b/win/tkWinDialog.c
index 8e0640f..e75d18b 100644
--- a/win/tkWinDialog.c
+++ b/win/tkWinDialog.c
@@ -8,7 +8,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkWinDialog.c,v 1.25 2002/02/08 02:57:11 dgp Exp $
+ * RCS: @(#) $Id: tkWinDialog.c,v 1.26 2002/04/12 07:18:49 hobbs Exp $
*
*/
@@ -495,7 +495,6 @@ GetFileNameW(clientData, interp, objc, objv, open)
int open; /* 1 to call GetOpenFileName(), 0 to
* call GetSaveFileName(). */
{
- Tcl_Encoding unicodeEncoding = Tcl_GetEncoding(NULL, "unicode");
OPENFILENAMEW ofn;
WCHAR file[TK_MULTI_MAX_PATH];
int result, winCode, oldMode, i, multi = 0;
@@ -504,6 +503,7 @@ GetFileNameW(clientData, interp, objc, objv, open)
HWND hWnd;
Tcl_DString utfFilterString, utfDirString;
Tcl_DString extString, filterString, dirString, titleString;
+ Tcl_Encoding unicodeEncoding = TkWinGetUnicodeEncoding();
ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
static CONST char *saveOptionStrings[] = {
@@ -2424,13 +2424,13 @@ Tk_MessageBoxObjCmd(clientData, interp, objc, objv)
int objc; /* Number of arguments. */
Tcl_Obj *CONST objv[]; /* Argument objects. */
{
- Tcl_Encoding unicodeEncoding = Tcl_GetEncoding(NULL, "unicode");
Tk_Window tkwin, parent;
HWND hWnd;
char *message, *title;
int defaultBtn, icon, type;
int i, oldMode, flags, winCode;
Tcl_DString messageString, titleString;
+ Tcl_Encoding unicodeEncoding = TkWinGetUnicodeEncoding();
static CONST char *optionStrings[] = {
"-default", "-icon", "-message", "-parent",
"-title", "-type", NULL
diff --git a/win/tkWinFont.c b/win/tkWinFont.c
index b98e3b9..c6111c8 100644
--- a/win/tkWinFont.c
+++ b/win/tkWinFont.c
@@ -11,7 +11,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkWinFont.c,v 1.14 2001/09/26 21:36:19 pspjuth Exp $
+ * RCS: @(#) $Id: tkWinFont.c,v 1.15 2002/04/12 07:18:49 hobbs Exp $
*/
#include "tkWinInt.h"
@@ -180,7 +180,6 @@ static Tcl_ThreadDataKey dataKey;
* Information cached about the system at startup time.
*/
-static Tcl_Encoding unicodeEncoding;
static Tcl_Encoding systemEncoding;
/*
@@ -248,7 +247,6 @@ void
TkpFontPkgInit(
TkMainInfo *mainPtr) /* The application being created. */
{
- unicodeEncoding = Tcl_GetEncoding(NULL, "unicode");
if (TkWinGetPlatformId() == VER_PLATFORM_WIN32_NT) {
/*
* If running NT, then we will be calling some Unicode functions
@@ -256,7 +254,7 @@ TkpFontPkgInit(
* make sure we convert to/from the Unicode char set.
*/
- systemEncoding = unicodeEncoding;
+ systemEncoding = TkWinGetUnicodeEncoding();
}
}
@@ -1082,7 +1080,7 @@ InitFont(
InitSubFont(hdc, hFont, 1, &fontPtr->subFontArray[0]);
encoding = fontPtr->subFontArray[0].familyPtr->encoding;
- if (encoding == unicodeEncoding) {
+ if (encoding == TkWinGetUnicodeEncoding()) {
GetCharWidthW(hdc, 0, BASE_CHARS - 1, fontPtr->widths);
} else {
GetCharWidthA(hdc, 0, BASE_CHARS - 1, fontPtr->widths);
@@ -1353,7 +1351,7 @@ FreeFontFamily(
if (familyPtr->endCount != NULL) {
ckfree((char *) familyPtr->endCount);
}
- if (familyPtr->encoding != unicodeEncoding) {
+ if (familyPtr->encoding != TkWinGetUnicodeEncoding()) {
Tcl_FreeEncoding(familyPtr->encoding);
}
@@ -1671,7 +1669,7 @@ FontMapLoadPage(
familyPtr = subFontPtr->familyPtr;
encoding = familyPtr->encoding;
- if (familyPtr->encoding == unicodeEncoding) {
+ if (familyPtr->encoding == TkWinGetUnicodeEncoding()) {
/*
* Font is Unicode. Few fonts are going to have all characters, so
* examine the TrueType character existence metrics to determine
diff --git a/win/tkWinInit.c b/win/tkWinInit.c
index ab8e2ae..fec211b 100644
--- a/win/tkWinInit.c
+++ b/win/tkWinInit.c
@@ -9,7 +9,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkWinInit.c,v 1.8 2002/01/29 20:51:24 andreas_kupries Exp $
+ * RCS: @(#) $Id: tkWinInit.c,v 1.9 2002/04/12 07:18:49 hobbs Exp $
*/
#include "tkWinInt.h"
@@ -124,8 +124,8 @@ TkpDisplayWarning(msg, title)
CONST char *msg; /* Message to be displayed. */
CONST char *title; /* Title of warning. */
{
- Tcl_Encoding unicodeEncoding = Tcl_GetEncoding(NULL, "unicode");
Tcl_DString msgString, titleString;
+ Tcl_Encoding unicodeEncoding = TkWinGetUnicodeEncoding();
Tcl_UtfToExternalDString(unicodeEncoding, msg, -1, &msgString);
Tcl_UtfToExternalDString(unicodeEncoding, title, -1, &titleString);
diff --git a/win/tkWinInt.h b/win/tkWinInt.h
index 49c3267..ca4916a 100644
--- a/win/tkWinInt.h
+++ b/win/tkWinInt.h
@@ -11,7 +11,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkWinInt.h,v 1.12 2001/12/28 23:43:21 hobbs Exp $
+ * RCS: @(#) $Id: tkWinInt.h,v 1.13 2002/04/12 07:18:49 hobbs Exp $
*/
#ifndef _TKWININT
@@ -193,7 +193,13 @@ EXTERN TkWinProcs *tkWinProcs;
#undef TCL_STORAGE_CLASS
#define TCL_STORAGE_CLASS DLLIMPORT
+/*
+ * The following allows us to cache these encoding for multiple functions.
+ */
+
+
extern Tcl_Encoding TkWinGetKeyInputEncoding _ANSI_ARGS_((void));
+extern Tcl_Encoding TkWinGetUnicodeEncoding _ANSI_ARGS_((void));
#endif /* _TKWININT */