summaryrefslogtreecommitdiffstats
path: root/generic/tkFont.c
diff options
context:
space:
mode:
authordas <das>2006-03-22 00:21:15 (GMT)
committerdas <das>2006-03-22 00:21:15 (GMT)
commit6b3ea13890d4e66f7983aaafcc40c5171dac8c66 (patch)
treefedd23bf410c6a013f190bd8aa27dbf9999214f1 /generic/tkFont.c
parentc029a6a633fafde728a101c77c67d1c4279d509a (diff)
downloadtk-6b3ea13890d4e66f7983aaafcc40c5171dac8c66.zip
tk-6b3ea13890d4e66f7983aaafcc40c5171dac8c66.tar.gz
tk-6b3ea13890d4e66f7983aaafcc40c5171dac8c66.tar.bz2
* generic/tkFont.c: implementation of ATSUI text rendering
* generic/tkInt.h: in TkAqua provided by Benjamin * generic/tkTextDisp.c: Riefenstahl. [Patch 638966] * library/demos/unicodeout.tcl: * macosx/tkMacOSXFont.h (new file): * macosx/tkMacOSXFont.c: * tests/font.test: * unix/tkUnixFont.c: * win/tkWinFont.c: * generic/tkFont.c: moved MODULE_SCOPE declarations of * generic/tkFont.h: font helper procs into header files. * macosx/tkMacOSXButton.c: * macosx/tkMacOSXFont.h: * macosx/tkMacOSXMenubutton.c: * macosx/Wish.xcode/project.pbxproj: add new tkMacOSXFont.h file, * macosx/Wish.xcodeproj/project.pbxproj: turn off dead code stripping as it interferes with -sectcreate (rdar://4486223). * macosx/Wish.xcode/default.pbxuser: add TCLLIBPATH=/Library/Tcl * macosx/Wish.xcodeproj/default.pbxuser: env var setting to tktest. * unix/configure.in: fix detection of symbols build when enabling TkAqua debug code; filter nm output of libtclstub better to avoid error on intel macs [Bug 1415789]. * unix/configure: autoconf-2.59
Diffstat (limited to 'generic/tkFont.c')
-rw-r--r--generic/tkFont.c55
1 files changed, 42 insertions, 13 deletions
diff --git a/generic/tkFont.c b/generic/tkFont.c
index 5166e04..3d64409 100644
--- a/generic/tkFont.c
+++ b/generic/tkFont.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: tkFont.c,v 1.27 2005/11/27 02:36:13 das Exp $
+ * RCS: @(#) $Id: tkFont.c,v 1.28 2006/03/22 00:21:16 das Exp $
*/
#include "tkPort.h"
@@ -343,8 +343,6 @@ static int SetFontFromAny(Tcl_Interp *interp, Tcl_Obj *objPtr);
static void TheWorldHasChanged(ClientData clientData);
static void UpdateDependentFonts(TkFontInfo *fiPtr,
Tk_Window tkwin, Tcl_HashEntry *namedHashPtr);
-MODULE_SCOPE int TkFontGetFirstTextLayout(Tk_TextLayout layout,
- Tk_Font *font, char *dst);
/*
* The following structure defines the implementation of the "font" Tcl
@@ -1721,14 +1719,15 @@ Tk_TextWidth(
/*
*---------------------------------------------------------------------------
*
- * Tk_UnderlineChars --
+ * Tk_UnderlineChars, TkUnderlineCharsInContext --
*
- * This function draws an underline for a given range of characters in a
- * given string. It doesn't draw the characters (which are assumed to
- * have been displayed previously); it just draws the underline. This
- * function would mainly be used to quickly underline a few characters
- * without having to construct an underlined font. To produce properly
- * underlined text, the appropriate underlined font should be constructed
+ * These procedures draw an underline for a given range of
+ * characters in a given string. They don't draw the characters
+ * (which are assumed to have been displayed previously); they
+ * just draw the underline. These procedures would mainly be
+ * used to quickly underline a few characters without having to
+ * construct an underlined font. To produce properly underlined
+ * text, the appropriate underlined font should be constructed
* and used.
*
* Results:
@@ -1758,12 +1757,42 @@ Tk_UnderlineChars(
* character. */
{
TkFont *fontPtr;
- int startX, endX;
fontPtr = (TkFont *) tkfont;
- Tk_MeasureChars(tkfont, string, firstByte, -1, 0, &startX);
- Tk_MeasureChars(tkfont, string, lastByte, -1, 0, &endX);
+ TkUnderlineCharsInContext(display, drawable, gc, tkfont, string,
+ lastByte, x, y, firstByte, lastByte);
+}
+
+void
+TkUnderlineCharsInContext(display, drawable, gc, tkfont, string, numBytes,
+ x, y, firstByte, lastByte)
+
+ Display *display; /* Display on which to draw. */
+ Drawable drawable; /* Window or pixmap in which to draw. */
+ GC gc; /* Graphics context for actually drawing
+ * line. */
+ Tk_Font tkfont; /* Font used in GC; must have been allocated
+ * by Tk_GetFont(). Used for character
+ * dimensions, etc. */
+ CONST char *string; /* String containing characters to be
+ * underlined or overstruck. */
+ int numBytes; /* Number of bytes in string. */
+ int x, y; /* Coordinates at which the first character
+ * of the whole string would be drawn. */
+ int firstByte; /* Index of first byte of first character. */
+ int lastByte; /* Index of first byte after the last
+ * character. */
+{
+ TkFont *fontPtr;
+ int startX, endX;
+
+ fontPtr = (TkFont *) tkfont;
+
+ TkpMeasureCharsInContext(tkfont, string, numBytes, 0, firstByte, -1, 0,
+ &startX);
+ TkpMeasureCharsInContext(tkfont, string, numBytes, 0, lastByte, -1, 0,
+ &endX);
XFillRectangle(display, drawable, gc, x + startX,
y + fontPtr->underlinePos, (unsigned int) (endX - startX),