diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2023-12-13 10:09:58 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2023-12-13 10:09:58 (GMT) |
commit | c253a25bf983c9a6f1ac39689d16b886fbbde7bf (patch) | |
tree | 04d4d861caa4e4dc9dbe83d3ea6b1cc5b5c54aea /generic/tkFont.c | |
parent | e2d41cd9d979b5877eba4870b5e20df072050acc (diff) | |
download | tk-c253a25bf983c9a6f1ac39689d16b886fbbde7bf.zip tk-c253a25bf983c9a6f1ac39689d16b886fbbde7bf.tar.gz tk-c253a25bf983c9a6f1ac39689d16b886fbbde7bf.tar.bz2 |
Fix Tk_CharBbox/Tk_DrawTextLayout signature (int -> Tcl_Size). Update documentation.
Diffstat (limited to 'generic/tkFont.c')
-rw-r--r-- | generic/tkFont.c | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/generic/tkFont.c b/generic/tkFont.c index e67be4e..384119c 100644 --- a/generic/tkFont.c +++ b/generic/tkFont.c @@ -73,9 +73,9 @@ typedef struct LayoutChunk { const char *start; /* Pointer to simple string to be displayed. * This is a pointer into the TkTextLayout's * string. */ - int numBytes; /* The number of bytes in this chunk. */ - int numChars; /* The number of characters in this chunk. */ - int numDisplayChars; /* The number of characters to display when + Tcl_Size numBytes; /* The number of bytes in this chunk. */ + Tcl_Size numChars; /* The number of characters in this chunk. */ + Tcl_Size numDisplayChars; /* The number of characters to display when * this chunk is displayed. Can be less than * numChars if extra space characters were * absorbed by the end of the chunk. This will @@ -98,7 +98,7 @@ typedef struct TextLayout { const char *string; /* The string that was layed out. */ int width; /* The maximum width of all lines in the text * layout. */ - int numChunks; /* Number of chunks actually used in following + Tcl_Size numChunks; /* Number of chunks actually used in following * array. */ LayoutChunk chunks[TKFLEXARRAY];/* Array of chunks. The actual size will be * maxChunks. THIS FIELD MUST BE THE LAST IN @@ -337,7 +337,7 @@ static void FreeFontObjProc(Tcl_Obj *objPtr); static int GetAttributeInfoObj(Tcl_Interp *interp, const TkFontAttributes *faPtr, Tcl_Obj *objPtr); static LayoutChunk * NewChunk(TextLayout **layoutPtrPtr, int *maxPtr, - const char *start, int numChars, int curX, + const char *start, Tcl_Size numChars, int curX, int newX, int y); static int ParseFontNameObj(Tcl_Interp *interp, Tk_Window tkwin, Tcl_Obj *objPtr, TkFontAttributes *faPtr); @@ -1987,7 +1987,8 @@ Tk_ComputeTextLayout( { TkFont *fontPtr = (TkFont *) tkfont; const char *start, *endp, *special; - int n, y, bytesThisChunk, maxChunks, curLine, layoutHeight; + Tcl_Size n; + int y, bytesThisChunk, maxChunks, curLine, layoutHeight; int baseline, height, curX, newX, maxWidth, *lineLengths; TextLayout *layoutPtr; LayoutChunk *chunkPtr; @@ -2310,10 +2311,10 @@ Tk_DrawTextLayout( * Tk_ComputeTextLayout(). */ int x, int y, /* Upper-left hand corner of rectangle in * which to draw (pixels). */ - int firstChar, /* The index of the first character to draw + Tcl_Size firstChar, /* The index of the first character to draw * from the given text item. 0 specifies the * beginning. */ - int lastChar) /* The index just after the last character to + Tcl_Size lastChar) /* The index just after the last character to * draw from the given text item. A number < 0 * means to draw all characters. */ { @@ -2322,7 +2323,8 @@ Tk_DrawTextLayout( TkDrawAngledTextLayout(display, drawable, gc, layout, x, y, 0.0, firstChar, lastChar); #else TextLayout *layoutPtr = (TextLayout *) layout; - int i, numDisplayChars, drawX; + int i, drawX; + Tcl_Size numDisplayChars; const char *firstByte, *lastByte; LayoutChunk *chunkPtr; @@ -2381,10 +2383,10 @@ TkDrawAngledTextLayout( int x, int y, /* Upper-left hand corner of rectangle in * which to draw (pixels). */ double angle, - int firstChar, /* The index of the first character to draw + Tcl_Size firstChar, /* The index of the first character to draw * from the given text item. 0 specifies the * beginning. */ - int lastChar) /* The index just after the last character to + Tcl_Size lastChar) /* The index just after the last character to * draw from the given text item. A number < 0 * means to draw all characters. */ { @@ -2743,7 +2745,7 @@ int Tk_CharBbox( Tk_TextLayout layout, /* Layout information, from a previous call to * Tk_ComputeTextLayout(). */ - int index, /* The index of the character whose bbox is + Tcl_Size index, /* The index of the character whose bbox is * desired. Negative means count backwards. */ int *xPtr, int *yPtr, /* Filled with the upper-left hand corner, in * pixels, of the bounding box for the @@ -3836,7 +3838,7 @@ NewChunk( TextLayout **layoutPtrPtr, int *maxPtr, const char *start, - int numBytes, + Tcl_Size numBytes, int curX, int newX, int y) @@ -4358,7 +4360,7 @@ TkFontGetFirstTextLayout( { TextLayout *layoutPtr = (TextLayout *) layout; LayoutChunk *chunkPtr; - int numBytesInChunk; + Tcl_Size numBytesInChunk; if ((layoutPtr == NULL) || (layoutPtr->numChunks == 0) || (layoutPtr->chunks->numDisplayChars <= 0)) { |