summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordas <das>2002-10-16 19:44:03 (GMT)
committerdas <das>2002-10-16 19:44:03 (GMT)
commitff6a1ec7eaa5b8dab045068c4321868cf1865e38 (patch)
treea3de38595586e599fadda3d5a3812472f5108f3b
parent3dfcc64d60f5d0a1018c5fe6ebd6f38db678e5bb (diff)
downloadtk-ff6a1ec7eaa5b8dab045068c4321868cf1865e38.zip
tk-ff6a1ec7eaa5b8dab045068c4321868cf1865e38.tar.gz
tk-ff6a1ec7eaa5b8dab045068c4321868cf1865e38.tar.bz2
* macosx/Wish.pbproj/project.pbxproj: added TEXT document
type to plist so that files can be dragged onto Wish Shell. * macosx/tkMacOSXInt.h: * macosx/tkMacOSXInit.c: * macosx/tkMacOSXFont.c: added private proc TkMacOSXUseAntialiasedText() to enable/disable quickdraw text antialiasing where available, default is enabled. Added a linked boolean ::tk::mac::antialiasedtext with write trace to allow control of antialiasing from tcl.
-rw-r--r--ChangeLog13
-rw-r--r--macosx/Wish.pbproj/project.pbxproj17
-rw-r--r--macosx/tkMacOSXFont.c90
-rw-r--r--macosx/tkMacOSXInit.c5
-rw-r--r--macosx/tkMacOSXInt.h4
5 files changed, 125 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index e6ebdfe..c1e36ef 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2002-10-17 Daniel Steffen <das@users.sourceforge.net>
+
+ * macosx/Wish.pbproj/project.pbxproj: added TEXT document
+ type to plist so that files can be dragged onto Wish Shell.
+
+ * macosx/tkMacOSXInt.h:
+ * macosx/tkMacOSXInit.c:
+ * macosx/tkMacOSXFont.c: added private proc
+ TkMacOSXUseAntialiasedText() to enable/disable quickdraw
+ text antialiasing where available, default is enabled.
+ Added a linked boolean ::tk::mac::antialiasedtext with
+ write trace to allow control of antialiasing from tcl.
+
2002-10-16 Vince Darley <vincentdarley@users.sourceforge.net>
* macosx/tkMacOSXMenu.c: fix to accelerators shown in menus
diff --git a/macosx/Wish.pbproj/project.pbxproj b/macosx/Wish.pbproj/project.pbxproj
index dfe39a7..45ab708 100644
--- a/macosx/Wish.pbproj/project.pbxproj
+++ b/macosx/Wish.pbproj/project.pbxproj
@@ -2776,6 +2776,23 @@ MacOS X Port by Jim Ingham &lt;jingham@apple.com&gt; &amp; Ian Reid, Copyright Â
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
+ <key>CFBundleDocumentTypes</key>
+ <array>
+ <dict>
+ <key>CFBundleTypeExtensions</key>
+ <array>
+ <string>*</string>
+ </array>
+ <key>CFBundleTypeName</key>
+ <string>NSStringPboardType</string>
+ <key>CFBundleTypeOSTypes</key>
+ <array>
+ <string>TEXT</string>
+ </array>
+ <key>CFBundleTypeRole</key>
+ <string>Viewer</string>
+ </dict>
+ </array>
<key>CFBundleExecutable</key>
<string>Wish Shell</string>
<key>CFBundleGetInfoString</key>
diff --git a/macosx/tkMacOSXFont.c b/macosx/tkMacOSXFont.c
index 40e637d..1a6556c 100644
--- a/macosx/tkMacOSXFont.c
+++ b/macosx/tkMacOSXFont.c
@@ -11,10 +11,12 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkMacOSXFont.c,v 1.2 2002/08/31 06:12:29 das Exp $
+ * RCS: @(#) $Id: tkMacOSXFont.c,v 1.3 2002/10/16 19:44:05 das Exp $
*/
#include <Carbon/Carbon.h>
+#include "tclInt.h"
+
#include "tkMacOSXInt.h"
#include "tkFont.h"
@@ -2189,3 +2191,89 @@ TkMacOSXInitControlFontStyle(Tk_Font tkfont, ControlFontStylePtr fsPtr)
fsPtr->style = fontPtr->style;
fsPtr->just = teCenter;
}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkMacOSXUseAntialiasedText --
+ *
+ * Enables or disables application-wide use of quickdraw
+ * antialiased text (where available).
+ * Sets up a linked tcl global boolean variable with write trace
+ * to allow disabling of antialiased text from tcl.
+ *
+ * Results:
+ * TCL_OK if facility was sucessfully enabled/disabled.
+ * TCL_ERROR if an error occurred or if facility is not available.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+#include <mach-o/dyld.h>
+
+/* define constants from 10.2 Quickdraw.h to enable compilation in 10.1 */
+#define kQDUseTrueTypeScalerGlyphs (1 << 0)
+#define kQDUseCGTextRendering (1 << 1)
+#define kQDUseCGTextMetrics (1 << 2)
+
+static int TkMacOSXAntialiasedTextEnabled = FALSE;
+
+static char *
+TkMacOSXAntialiasedTextVariableProc(clientData, interp, name1, name2, flags)
+ ClientData clientData;
+ Tcl_Interp *interp;
+ CONST char *name1;
+ CONST char *name2;
+ int flags;
+{
+ TkMacOSXUseAntialiasedText(interp, TkMacOSXAntialiasedTextEnabled);
+ return (char *) NULL;
+}
+
+int TkMacOSXUseAntialiasedText(interp, enable)
+ Tcl_Interp *interp;
+ int enable;
+{
+ static Boolean initialized = FALSE;
+ static UInt32 (*swaptextflags)(UInt32) = NULL;
+
+ if(!initialized) {
+ NSSymbol nsSymbol=NULL;
+ if(NSIsSymbolNameDefinedWithHint("_QDSwapTextFlags", "QD")) {
+ nsSymbol = NSLookupAndBindSymbolWithHint("_QDSwapTextFlags", "QD");
+ } else if(NSIsSymbolNameDefinedWithHint("_SwapQDTextFlags", "QD")) {
+ nsSymbol = NSLookupAndBindSymbolWithHint("_SwapQDTextFlags", "QD");
+ }
+ if(nsSymbol) {
+ swaptextflags = NSAddressOfSymbol(nsSymbol);
+ }
+ initialized = TRUE;
+
+ TkMacOSXAntialiasedTextEnabled = (swaptextflags ? enable : FALSE);
+ if (Tcl_CreateNamespace(interp, "::tk::mac", NULL, NULL) == NULL) {
+ Tcl_ResetResult(interp);
+ }
+ if (Tcl_TraceVar(interp, "::tk::mac::antialiasedtext",
+ TCL_GLOBAL_ONLY | TCL_TRACE_WRITES,
+ TkMacOSXAntialiasedTextVariableProc, NULL) != TCL_OK) {
+ Tcl_ResetResult(interp);
+ }
+ if (Tcl_LinkVar(interp, "::tk::mac::antialiasedtext",
+ (char *) &TkMacOSXAntialiasedTextEnabled,
+ TCL_LINK_BOOLEAN) != TCL_OK) {
+ Tcl_ResetResult(interp);
+ }
+ }
+ if(swaptextflags) {
+ swaptextflags(enable ? kQDUseCGTextRendering | kQDUseCGTextMetrics
+ : kQDUseTrueTypeScalerGlyphs);
+ TkMacOSXAntialiasedTextEnabled = enable;
+ return TCL_OK;
+ } else {
+ TkMacOSXAntialiasedTextEnabled = FALSE;
+ return TCL_ERROR;
+ }
+}
diff --git a/macosx/tkMacOSXInit.c b/macosx/tkMacOSXInit.c
index ffcab99..2180769 100644
--- a/macosx/tkMacOSXInit.c
+++ b/macosx/tkMacOSXInit.c
@@ -10,7 +10,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkMacOSXInit.c,v 1.2 2002/08/31 06:12:30 das Exp $
+ * RCS: @(#) $Id: tkMacOSXInit.c,v 1.3 2002/10/16 19:44:05 das Exp $
*/
#include "tkInt.h"
@@ -72,7 +72,7 @@ static Map scriptMap[] = {
Tcl_Encoding TkMacOSXCarbonEncoding = NULL;
-
+
/*
*----------------------------------------------------------------------
*
@@ -111,6 +111,7 @@ TkpInit(interp)
Tk_MacOSXSetupTkNotifier();
TkMacOSXInitAppleEvents(interp);
TkMacOSXInitMenus(interp);
+ TkMacOSXUseAntialiasedText(interp, TRUE);
}
if (carbonEncodingInitialized == false) {
diff --git a/macosx/tkMacOSXInt.h b/macosx/tkMacOSXInt.h
index b609d6e..4d7b840 100644
--- a/macosx/tkMacOSXInt.h
+++ b/macosx/tkMacOSXInt.h
@@ -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: tkMacOSXInt.h,v 1.2 2002/08/31 06:12:30 das Exp $
+ * RCS: @(#) $Id: tkMacOSXInt.h,v 1.3 2002/10/16 19:44:05 das Exp $
*/
#ifndef _TKMACINT
@@ -150,6 +150,8 @@ extern TkMacOSXWindowList *tkMacOSXWindowListPtr;
extern Tcl_Encoding TkMacOSXCarbonEncoding;
+extern int TkMacOSXUseAntialiasedText(Tcl_Interp *interp, int enable);
+
#include "tkIntPlatDecls.h"
#endif /* _TKMACINT */