Skip to content

Commit

Permalink
int -> Tcl_Size in font handling (not done yet)
Browse files Browse the repository at this point in the history
  • Loading branch information
jan.nijtmans committed Mar 19, 2024
1 parent 73a13ad commit 443d48d
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 15 deletions.
11 changes: 5 additions & 6 deletions unix/tkUnixFont.c
Original file line number Diff line number Diff line change
Expand Up @@ -1007,7 +1007,7 @@ Tk_MeasureChars(
Tk_Font tkfont, /* Font in which characters will be drawn. */
const char *source, /* UTF-8 string to be displayed. Need not be
* '\0' terminated. */
Tcl_Size numBytes1, /* Maximum number of bytes to consider from
Tcl_Size numBytes, /* Maximum number of bytes to consider from
* source string. */
int maxLength, /* If >= 0, maxLength specifies the longest
* permissible line length in pixels; don't
Expand All @@ -1025,10 +1025,10 @@ Tk_MeasureChars(
int *lengthPtr) /* Filled with x-location just after the
* terminating character. */
{
int numBytes = numBytes1;
UnixFont *fontPtr;
SubFont *lastSubFontPtr;
int curX, curByte, ch;
Tcl_Size curByte;
int curX, ch;

/*
* Unix does not use kerning or fractional character widths when
Expand Down Expand Up @@ -3106,7 +3106,7 @@ GetImageOfText(
* is passed to this function. If they are not
* stripped out, they will be displayed as
* regular printing characters. */
int numBytes, /* Number of bytes in string. */
Tcl_Size numBytes, /* Number of bytes in string. */
int *realWidthPtr, int *realHeightPtr)
{
int width, height;
Expand Down Expand Up @@ -3188,11 +3188,10 @@ TkDrawAngledChars(
* is passed to this function. If they are not
* stripped out, they will be displayed as
* regular printing characters. */
Tcl_Size numBytes1, /* Number of bytes in string. */
Tcl_Size numBytes, /* Number of bytes in string. */
double x, double y,
double angle)
{
int numBytes = numBytes1;
if (angle == 0.0) {
Tk_DrawChars(display, drawable, gc, tkfont, source, numBytes, x, y);
} else {
Expand Down
14 changes: 7 additions & 7 deletions unix/tkUnixRFont.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ TCL_DECLARE_MUTEX(xftMutex);
*-------------------------------------------------------------------------
*/

static int utf8ToUcs4(const char *source, FcChar32 *c, int numBytes)
static Tcl_Size utf8ToUcs4(const char *source, FcChar32 *c, Tcl_Size numBytes)
{
if (numBytes >= 6) {
return TkUtfToUniChar(source, (int *)c);
Expand Down Expand Up @@ -705,7 +705,7 @@ Tk_MeasureChars(
Tk_Font tkfont, /* Font in which characters will be drawn. */
const char *source, /* UTF-8 string to be displayed. Need not be
* '\0' terminated. */
Tcl_Size numBytes1, /* Maximum number of bytes to consider from
Tcl_Size numBytes, /* Maximum number of bytes to consider from
* source string. */
int maxLength, /* If >= 0, maxLength specifies the longest
* permissible line length in pixels; don't
Expand All @@ -723,12 +723,12 @@ Tk_MeasureChars(
int *lengthPtr) /* Filled with x-location just after the
* terminating character. */
{
int numBytes = numBytes1;
UnixFtFont *fontPtr = (UnixFtFont *) tkfont;
XftFont *ftFont;
FcChar32 c;
XGlyphInfo extents;
int clen, curX, newX, curByte, newByte, sawNonSpace;
Tcl_Size clen;
int curX, newX, curByte, newByte, sawNonSpace;
int termByte = 0, termX = 0, errorFlag = 0;
Tk_ErrorHandler handler;
#ifdef DEBUG_FONTSEL
Expand Down Expand Up @@ -1068,12 +1068,11 @@ TkDrawAngledChars(
* is passed to this function. If they are not
* stripped out, they will be displayed as
* regular printing characters. */
Tcl_Size numBytes1, /* Number of bytes in string. */
Tcl_Size numBytes, /* Number of bytes in string. */
double x, double y, /* Coordinates at which to place origin of
* string when drawing. */
double angle) /* What angle to put text at, in degrees. */
{
int numBytes = numBytes1;
const int maxCoord = 0x7FFF;/* Xft coordinates are 16 bit values */
const int minCoord = -maxCoord-1;
UnixFtFont *fontPtr = (UnixFtFont *) tkfont;
Expand Down Expand Up @@ -1202,7 +1201,8 @@ TkDrawAngledChars(
}
}
#else /* !XFT_HAS_FIXED_ROTATED_PLACEMENT */
int clen, nspec;
Tcl_Size clen;
int nspec;
XftGlyphFontSpec specs[NUM_SPEC];
XGlyphInfo metrics;
double sinA = sin(angle * PI/180.0), cosA = cos(angle * PI/180.0);
Expand Down
3 changes: 1 addition & 2 deletions win/tkWinFont.c
Original file line number Diff line number Diff line change
Expand Up @@ -790,7 +790,7 @@ Tk_MeasureChars(
Tk_Font tkfont, /* Font in which characters will be drawn. */
const char *source, /* UTF-8 string to be displayed. Need not be
* '\0' terminated. */
Tcl_Size numBytes1, /* Maximum number of bytes to consider from
Tcl_Size numBytes, /* Maximum number of bytes to consider from
* source string. */
int maxLength, /* If >= 0, maxLength specifies the longest
* permissible line length in pixels; don't
Expand All @@ -810,7 +810,6 @@ Tk_MeasureChars(
int *lengthPtr) /* Filled with x-location just after the
* terminating character. */
{
int numBytes = numBytes1;
HDC hdc;
HFONT oldFont;
WinFont *fontPtr;
Expand Down

0 comments on commit 443d48d

Please sign in to comment.