summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mac/tkMacFont.c89
-rw-r--r--mac/tkMacMenu.c63
-rw-r--r--mac/tkMacWindowMgr.c5
3 files changed, 96 insertions, 61 deletions
diff --git a/mac/tkMacFont.c b/mac/tkMacFont.c
index b68f414..200ed4f 100644
--- a/mac/tkMacFont.c
+++ b/mac/tkMacFont.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: tkMacFont.c,v 1.4 1999/04/16 01:51:30 stanton Exp $
+ * RCS: @(#) $Id: tkMacFont.c,v 1.5 1999/12/07 03:04:51 hobbs Exp $
*/
#include <Windows.h>
@@ -1721,7 +1721,11 @@ FontMapLoadPage(
unsigned char buf[16];
int srcRead, dstWrote;
Tcl_Encoding encoding;
-
+ Handle fHandle;
+ short theID;
+ ResType theType;
+ Str255 theName;
+
subFontPtr->fontMap[row] = (char *) ckalloc(FONTMAP_BITSPERPAGE / 8);
memset(subFontPtr->fontMap[row], 0, FONTMAP_BITSPERPAGE / 8);
@@ -1738,36 +1742,65 @@ FontMapLoadPage(
fm.denom.v = 1;
#if !defined(UNIVERSAL_INTERFACES_VERSION) || (UNIVERSAL_INTERFACES_VERSION < 0x0300)
- fontRecPtr = *((FontRec **) FMSwapFont(&fm)->fontResult);
+ fHandle = FMSwapFont(&fm)->fontHandle;
#else
- fontRecPtr = *((FontRec **) FMSwapFont(&fm)->fontHandle);
+ fHandle = FMSwapFont(&fm)->fontHandle;
#endif
- widths = (short *) ((long) &fontRecPtr->owTLoc
- + ((long) (fontRecPtr->owTLoc - fontRecPtr->firstChar)
- * sizeof(short)));
+ GetResInfo(fHandle, &theID, &theType, theName);
isMultiByteFont = subFontPtr->familyPtr->isMultiByteFont;
-
- end = (row + 1) << FONTMAP_SHIFT;
- for (i = row << FONTMAP_SHIFT; i < end; i++) {
- if (Tcl_UtfToExternal(NULL, encoding, src, Tcl_UniCharToUtf(i, src),
- TCL_ENCODING_STOPONERROR, NULL, (char *) buf, sizeof(buf),
- &srcRead, &dstWrote, NULL) == TCL_OK) {
-
- if (((isMultiByteFont != 0) && (buf[0] > 31))
- || (widths[buf[0]] != -1)) {
- if ((buf[0] == 0x11) && (widths[0x12] == -1)) {
- continue;
- }
-
- /*
- * Mac's char existence metrics are only for one-byte
- * characters. If we have a double-byte char, just
- * assume that the font supports that char if the font's
- * encoding supports that char.
- */
+ if( theType=='sfnt' ) {
+ /*
+ * Found an outline font which has very complex font record.
+ * Let's just assume *ALL* the characters are allowed.
+ */
+
+ end = (row + 1) << FONTMAP_SHIFT;
+ for (i = row << FONTMAP_SHIFT; i < end; i++) {
+ if (Tcl_UtfToExternal(NULL, encoding, src, Tcl_UniCharToUtf(i,
+ src),
+ TCL_ENCODING_STOPONERROR, NULL, (char *) buf,
+ sizeof(buf),
+ &srcRead, &dstWrote, NULL) == TCL_OK) {
+ bitOffset = i & (FONTMAP_BITSPERPAGE - 1);
+ subFontPtr->fontMap[row][bitOffset >> 3] |= 1
+ << (bitOffset & 7);
+ }
+ }
+ } else {
+ /*
+ * Found an old bitmap font which has a well-defined record.
+ * We can check the width table to see which characters exist.
+ */
+
+ fontRecPtr = *((FontRec **) fHandle );
+ widths = (short *) ((long) &fontRecPtr->owTLoc
+ + ((long) (fontRecPtr->owTLoc - fontRecPtr->firstChar)
+ * sizeof(short)));
+
+ end = (row + 1) << FONTMAP_SHIFT;
+ for (i = row << FONTMAP_SHIFT; i < end; i++) {
+ if (Tcl_UtfToExternal(NULL, encoding, src,
+ Tcl_UniCharToUtf(i, src),
+ TCL_ENCODING_STOPONERROR, NULL, (char *) buf, sizeof(buf),
+ &srcRead, &dstWrote, NULL) == TCL_OK) {
- bitOffset = i & (FONTMAP_BITSPERPAGE - 1);
- subFontPtr->fontMap[row][bitOffset >> 3] |= 1 << (bitOffset & 7);
+ if (((isMultiByteFont != 0) && (buf[0] > 31))
+ || (widths[buf[0]] != -1)) {
+ if ((buf[0] == 0x11) && (widths[0x12] == -1)) {
+ continue;
+ }
+
+ /*
+ * Mac's char existence metrics are only for one-byte
+ * characters. If we have a double-byte char, just
+ * assume that the font supports that char if the font's
+ * encoding supports that char.
+ */
+
+ bitOffset = i & (FONTMAP_BITSPERPAGE - 1);
+ subFontPtr->fontMap[row][bitOffset >> 3] |= 1
+ << (bitOffset & 7);
+ }
}
}
}
diff --git a/mac/tkMacMenu.c b/mac/tkMacMenu.c
index e1a1103..2044a0a 100644
--- a/mac/tkMacMenu.c
+++ b/mac/tkMacMenu.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: tkMacMenu.c,v 1.13 1999/08/13 08:07:02 jingham Exp $
+ * RCS: @(#) $Id: tkMacMenu.c,v 1.14 1999/12/07 03:04:51 hobbs Exp $
*/
#include "tkMacInt.h"
@@ -712,24 +712,24 @@ GetEntryText(
} else if (mePtr->bitmapPtr != NULL) {
Tcl_DStringAppend(dStringPtr, "(Pixmap)", -1);
} else if (mePtr->labelPtr == NULL || mePtr->labelLength == 0) {
-
/*
* The Mac menu manager does not like null strings.
*/
-
+
Tcl_DStringAppend(dStringPtr, " ", -1);
} else {
int length;
char *text = Tcl_GetStringFromObj(mePtr->labelPtr, &length);
char *dStringText;
int i;
-
- for (i = 0; i < length; text++, i++) {
+
+ for (i = 0; *text; text++, i++) {
if ((*text == '.')
&& (*(text + 1) != '\0') && (*(text + 1) == '.')
&& (*(text + 2) != '\0') && (*(text + 2) == '.')) {
Tcl_DStringAppend(dStringPtr, elipsisString, -1);
i += strlen(elipsisString) - 1;
+ text += 2;
} else {
Tcl_DStringSetLength(dStringPtr,
Tcl_DStringLength(dStringPtr) + 1);
@@ -751,11 +751,11 @@ GetEntryText(
*
* We try the following special mac characters. If none of them
* are present, just use the check mark.
- * '' - Check mark character
- * '´' - Bullet character
- * '' - Filled diamond
- * '×' - Hollow diamond
- * '„' = Long dash ("em dash")
+ * '' - Check mark character (\022)
+ * '´' - Bullet character (\264 or \245 ??)
+ * '' - Filled diamond (\023)
+ * '×' - Hollow diamond (\327)
+ * '„' = Long dash ("em dash") (\204 or \321 ??)
* '-' = short dash (minus, "en dash");
*
* Results:
@@ -779,20 +779,20 @@ FindMarkCharacter(
(mePtr->fontPtr == NULL) ? mePtr->menuPtr->fontPtr
: mePtr->fontPtr);
- if (!TkMacIsCharacterMissing(tkfont, '')) {
- markChar = '';
- } else if (!TkMacIsCharacterMissing(tkfont, '´')) {
- markChar = '´';
- } else if (!TkMacIsCharacterMissing(tkfont, '')) {
- markChar = '';
- } else if (!TkMacIsCharacterMissing(tkfont, '×')) {
- markChar = '×';
- } else if (!TkMacIsCharacterMissing(tkfont, '„')) {
- markChar = '„';
+ if (!TkMacIsCharacterMissing(tkfont, '\022')) {
+ markChar = '\022'; /* Check mark */
+ } else if (!TkMacIsCharacterMissing(tkfont, '\264')) {
+ markChar = '´'; /* Bullet */
+ } else if (!TkMacIsCharacterMissing(tkfont, '\023')) {
+ markChar = '\023'; /* Filled Diamond */
+ } else if (!TkMacIsCharacterMissing(tkfont, '\327')) {
+ markChar = '\327'; /* Hollow Diamond */
+ } else if (!TkMacIsCharacterMissing(tkfont, '\204')) {
+ markChar = '\204'; /* Lond Dash */
} else if (!TkMacIsCharacterMissing(tkfont, '-')) {
- markChar = '-';
+ markChar = '-'; /* Short Dash */
} else {
- markChar = '';
+ markChar = '\022'; /* Check mark */
}
return markChar;
}
@@ -1061,7 +1061,7 @@ ReconfigureIndividualMenu(
TkMenuEntry *mePtr;
Str255 itemText;
int parentDisabled = 0;
-
+
for (mePtr = menuPtr->menuRefPtr->parentEntryPtr; mePtr != NULL;
mePtr = mePtr->nextCascadePtr) {
char *name = (mePtr->namePtr == NULL) ? ""
@@ -1175,10 +1175,10 @@ ReconfigureIndividualMenu(
}
if ((mePtr->type != CASCADE_ENTRY)
- && (ENTRY_COMMAND_ACCEL
- == (mePtr->entryFlags & ENTRY_ACCEL_MASK))) {
+ && (ENTRY_COMMAND_ACCEL
+ == (mePtr->entryFlags & ENTRY_ACCEL_MASK))) {
char *accel = Tcl_GetStringFromObj(mePtr->accelPtr, NULL);
- SetItemCmd(macMenuHdl, index, accel[((EntryGeometry *)
+ SetItemCmd(macMenuHdl, base + index, accel[((EntryGeometry *)
mePtr->platformEntryData)->accelTextStart]);
}
}
@@ -3574,7 +3574,6 @@ TkpDrawMenuEntry(
Tk_FontMetrics entryMetrics;
int adjustedY = y + padY;
int adjustedHeight = height - 2 * padY;
- int state;
/*
* Choose the gc for drawing the foreground part of the entry.
@@ -3605,7 +3604,7 @@ TkpDrawMenuEntry(
}
}
- if (((parentDisabled || (state == ENTRY_DISABLED)))
+ if (((parentDisabled || (mePtr->state == ENTRY_DISABLED)))
&& (menuPtr->disabledFgPtr != NULL)) {
gc = mePtr->disabledGC;
if (gc == NULL) {
@@ -4378,12 +4377,12 @@ TkpMenuInit(void)
currentMenuBarInterp = NULL;
currentMenuBarName = NULL;
windowListPtr = NULL;
-
+
/*
* Get the GC that we will use as the sign to the font
* routines that they should not muck with the foreground color...
*/
-
+
if (TkMacHaveAppearance() > 1) {
XGCValues tmpValues;
TkColor *tmpColorPtr;
@@ -4397,8 +4396,8 @@ TkpMenuInit(void)
}
FixMDEF();
-
- Tcl_ExternalToUtf(NULL, NULL, "É", -1, 0, NULL, elipsisString,
+ Tcl_ExternalToUtf(NULL, NULL, "\311", /* É */
+ -1, 0, NULL, elipsisString,
TCL_UTF_MAX + 1, NULL, NULL, NULL);
}
diff --git a/mac/tkMacWindowMgr.c b/mac/tkMacWindowMgr.c
index 48ada11..81bda7a 100644
--- a/mac/tkMacWindowMgr.c
+++ b/mac/tkMacWindowMgr.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: tkMacWindowMgr.c,v 1.4 1999/04/16 01:51:32 stanton Exp $
+ * RCS: @(#) $Id: tkMacWindowMgr.c,v 1.5 1999/12/07 03:04:52 hobbs Exp $
*/
#include <Events.h>
@@ -207,10 +207,13 @@ WindowManagerMouse(
{
int oldMode;
KeyMap theKeys;
+ void TkpPreprocessMacMenu(void);
GetKeys(theKeys);
oldMode = Tcl_SetServiceMode(TCL_SERVICE_ALL);
TkMacClearMenubarActive();
+ /* POSTCOMMAND??? */
+ TkpPreprocessMacMenu();
TkMacHandleMenuSelect(MenuSelect(eventPtr->where),
theKeys[1] & 4);
Tcl_SetServiceMode(oldMode);