summaryrefslogtreecommitdiffstats
path: root/unix
diff options
context:
space:
mode:
authorstanton <stanton>1999-03-30 04:12:54 (GMT)
committerstanton <stanton>1999-03-30 04:12:54 (GMT)
commit972f48be963549c14625ebae0251268ebded7727 (patch)
tree57a02adab1c57d9f785cee49eb57a23b6bbe70fd /unix
parent69b4a640eb954dbb23cc09e9d993c41b214e765c (diff)
downloadtk-972f48be963549c14625ebae0251268ebded7727.zip
tk-972f48be963549c14625ebae0251268ebded7727.tar.gz
tk-972f48be963549c14625ebae0251268ebded7727.tar.bz2
* doc/MeasureChar.3:
* doc/TextLayout.3: * generic/tk.decls: * generic/tkCanvText.c: * generic/tkEntry.c: * generic/tkFont.c: * generic/tkListbox.c: * generic/tkMessage.c: * mac/tkMacFont.c: * unix/tkUnixButton.c: * unix/tkUnixFont.c: * unix/tkUnixMenu.c: * win/tkWinFont.c: * win/tkWinMenu.c: Standardized text layout and font interfaces so they are consistent with respect to byte versus character oriented indices. The layout functions all manipulate character oriented values while the lower level measurement functions all operate on byte oriented values. This distinction was not clear and so the functions were being used improperly in a number of places. [Bug: 1053, 747, 749, 1646] * generic/tk.decls: Eliminated uses of C++ STL types string and list from declarations. * generic/tkFont.c: Changes to named fonts were not being propagated in some cases. [Bug: 1144]
Diffstat (limited to 'unix')
-rw-r--r--unix/tkUnixButton.c11
-rw-r--r--unix/tkUnixFont.c4
-rw-r--r--unix/tkUnixMenu.c10
3 files changed, 12 insertions, 13 deletions
diff --git a/unix/tkUnixButton.c b/unix/tkUnixButton.c
index 25228d2..bd1d7f1 100644
--- a/unix/tkUnixButton.c
+++ b/unix/tkUnixButton.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: tkUnixButton.c,v 1.1.4.2 1998/09/30 02:19:14 stanton Exp $
+ * RCS: @(#) $Id: tkUnixButton.c,v 1.1.4.3 1999/03/30 04:12:59 stanton Exp $
*/
#include "tkButton.h"
@@ -395,12 +395,8 @@ TkpComputeButtonGeometry(butPtr)
register TkButton *butPtr; /* Button whose geometry may have changed. */
{
int width, height, avgWidth;
- int length;
- char *text;
Tk_FontMetrics fm;
- text = Tcl_GetStringFromObj(butPtr->textPtr, &length);
-
butPtr->inset = butPtr->highlightWidth + butPtr->borderWidth;
/*
@@ -433,9 +429,10 @@ TkpComputeButtonGeometry(butPtr)
goto imageOrBitmap;
} else {
Tk_FreeTextLayout(butPtr->textLayout);
+
butPtr->textLayout = Tk_ComputeTextLayout(butPtr->tkfont,
- text, length, butPtr->wrapLength, butPtr->justify, 0,
- &butPtr->textWidth, &butPtr->textHeight);
+ Tcl_GetString(butPtr->textPtr), -1, butPtr->wrapLength,
+ butPtr->justify, 0, &butPtr->textWidth, &butPtr->textHeight);
width = butPtr->textWidth;
height = butPtr->textHeight;
diff --git a/unix/tkUnixFont.c b/unix/tkUnixFont.c
index 6c4afdf..c4844c6 100644
--- a/unix/tkUnixFont.c
+++ b/unix/tkUnixFont.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: tkUnixFont.c,v 1.1.4.6 1998/12/13 08:14:39 lfb Exp $
+ * RCS: @(#) $Id: tkUnixFont.c,v 1.1.4.7 1999/03/30 04:12:59 stanton Exp $
*/
#include "tkUnixInt.h"
@@ -679,7 +679,7 @@ TkpGetSubFonts(interp, tkfont)
* the characters.
*
* Results:
- * The return value is the number of characters from source that
+ * The return value is the number of bytes from source that
* fit into the span that extends from 0 to maxLength. *lengthPtr is
* filled with the x-coordinate of the right edge of the last
* character that did fit.
diff --git a/unix/tkUnixMenu.c b/unix/tkUnixMenu.c
index 4ab1221..adbfb52 100644
--- a/unix/tkUnixMenu.c
+++ b/unix/tkUnixMenu.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: tkUnixMenu.c,v 1.1.4.6 1999/03/09 01:36:07 lfb Exp $
+ * RCS: @(#) $Id: tkUnixMenu.c,v 1.1.4.7 1999/03/30 04:13:00 stanton Exp $
*/
#include "tkPort.h"
@@ -803,6 +803,8 @@ DrawMenuUnderline(menuPtr, mePtr, d, gc, tkfont, fmPtr, x, y, width, height)
int activeBorderWidth;
int leftEdge;
char *label = Tcl_GetStringFromObj(mePtr->labelPtr, NULL);
+ char *start = Tcl_UtfAtIndex(label, mePtr->underline);
+ char *end = Tcl_UtfNext(start);
Tk_GetPixelsFromObj(NULL, menuPtr->tkwin,
menuPtr->activeBorderWidthPtr, &activeBorderWidth);
@@ -810,10 +812,10 @@ DrawMenuUnderline(menuPtr, mePtr, d, gc, tkfont, fmPtr, x, y, width, height)
if (menuPtr->menuType == MENUBAR) {
leftEdge += 5;
}
-
+
Tk_UnderlineChars(menuPtr->display, d, gc, tkfont, label,
leftEdge, y + (height + fmPtr->ascent - fmPtr->descent) / 2,
- mePtr->underline, mePtr->underline + 1);
+ start - label, end - label);
}
}
@@ -903,7 +905,7 @@ GetTearoffEntryGeometry(menuPtr, mePtr, tkfont, fmPtr, widthPtr, heightPtr)
*widthPtr = 0;
} else {
*heightPtr = fmPtr->linespace;
- *widthPtr = Tk_TextWidth(tkfont, "W", -1);
+ *widthPtr = Tk_TextWidth(tkfont, "W", 1);
}
}