summaryrefslogtreecommitdiffstats
path: root/generic/tkText.c
diff options
context:
space:
mode:
authorvincentdarley <vincentdarley>2003-11-21 18:51:18 (GMT)
committervincentdarley <vincentdarley>2003-11-21 18:51:18 (GMT)
commite12ef8efd22290667ca8025a561c41bd0a0dc872 (patch)
treeb496eb8e8536a2cf8b8507d74d0a2f3e4afe60eb /generic/tkText.c
parentfdda3361d0bfd7bf2eaab1a47112b09989cc707a (diff)
downloadtk-e12ef8efd22290667ca8025a561c41bd0a0dc872.zip
tk-e12ef8efd22290667ca8025a561c41bd0a0dc872.tar.gz
tk-e12ef8efd22290667ca8025a561c41bd0a0dc872.tar.bz2
correct handling of interpolated tabs using fractional pixel widths
Diffstat (limited to 'generic/tkText.c')
-rw-r--r--generic/tkText.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/generic/tkText.c b/generic/tkText.c
index 133d88d..c5c8baa 100644
--- a/generic/tkText.c
+++ b/generic/tkText.c
@@ -14,7 +14,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkText.c,v 1.44 2003/11/15 02:33:50 vincentdarley Exp $
+ * RCS: @(#) $Id: tkText.c,v 1.45 2003/11/21 18:51:18 vincentdarley Exp $
*/
#include "default.h"
@@ -3310,6 +3310,7 @@ TkTextGetTabs(interp, tkwin, stringPtr)
TkTextTabArray *tabArrayPtr;
TkTextTab *tabPtr;
Tcl_UniChar ch;
+ double prevStop, lastStop;
/* Map these strings to TkTextTabAlign values */
@@ -3342,6 +3343,8 @@ TkTextGetTabs(interp, tkwin, stringPtr)
tabArrayPtr = (TkTextTabArray *) ckalloc((unsigned)
(sizeof(TkTextTabArray) + (count-1)*sizeof(TkTextTab)));
tabArrayPtr->numTabs = 0;
+ prevStop = 0.0;
+ lastStop = 0.0;
for (i = 0, tabPtr = &tabArrayPtr->tabs[0]; i < objc; i++, tabPtr++) {
int index;
@@ -3349,6 +3352,14 @@ TkTextGetTabs(interp, tkwin, stringPtr)
!= TCL_OK) {
goto error;
}
+
+ prevStop = lastStop;
+ if (Tk_GetMMFromObj(interp, tkwin, objv[i], &lastStop) != TCL_OK) {
+ goto error;
+ }
+ lastStop *= WidthOfScreen(Tk_Screen(tkwin));
+ lastStop /= WidthMMOfScreen(Tk_Screen(tkwin));
+
tabArrayPtr->numTabs++;
/*
@@ -3373,6 +3384,15 @@ TkTextGetTabs(interp, tkwin, stringPtr)
}
tabPtr->alignment = ((TkTextTabAlign)index);
}
+
+ /*
+ * For when we need to interpolate tab stops, store
+ * these two so we know the tab stop size to very
+ * high precision.
+ */
+ tabArrayPtr->lastTab = lastStop;
+ tabArrayPtr->tabIncrement = lastStop - prevStop;
+
return tabArrayPtr;
error: