From dc7e102c0d1dbe5be1229da812fec34eaeb1c7bf Mon Sep 17 00:00:00 2001 From: fvogel Date: Wed, 15 May 2024 22:00:51 +0000 Subject: Add test font-44.3 demonstrating bug [8162e9b7a9]. --- tests/font.test | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/font.test b/tests/font.test index 4a264f8..98c1112 100644 --- a/tests/font.test +++ b/tests/font.test @@ -2364,6 +2364,13 @@ test font-44.2 {TkFontGetPoints: size >= 0} -constraints {noExceed haveTimes12Fo } -cleanup { tk scaling $oldscale } -result 12 +test font-44.3 {font create with display scaling not 100% - bug 8162e9b7a9} -body { + set font1 TkDefaultFont + set font2 [font create Font2 {*}[font actual $font1]] + expr {[font actual $font1 -size] == [font actual $font2 -size]} +} -cleanup { + font delete $font2 +} -result 1 test font-45.1 {TkFontGetAliasList: no match} -body { -- cgit v0.12 From 9d8fd009e8a34652cb49be13d2dc96dda78bd4d5 Mon Sep 17 00:00:00 2001 From: fvogel Date: Thu, 16 May 2024 20:39:56 +0000 Subject: The XFT_PIXEL_SIZE property is a double in fontconfig. See also [434d294df8]. --- unix/tkUnixRFont.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/unix/tkUnixRFont.c b/unix/tkUnixRFont.c index baf9071..f3ab5c9 100644 --- a/unix/tkUnixRFont.c +++ b/unix/tkUnixRFont.c @@ -184,8 +184,8 @@ GetTkFontAttributes( { const char *family = "Unknown"; const char *const *familyPtr = &family; - int weight, slant, pxsize; - double size, ptsize; + int weight, slant; + double size, ptsize, pxsize; (void) XftPatternGetString(ftFont->pattern, XFT_FAMILY, 0, familyPtr); if (XftPatternGetDouble(ftFont->pattern, XFT_PIXEL_SIZE, 0, @@ -194,9 +194,9 @@ GetTkFontAttributes( } else if (XftPatternGetDouble(ftFont->pattern, XFT_SIZE, 0, &ptsize) == XftResultMatch) { size = ptsize; - } else if (XftPatternGetInteger(ftFont->pattern, XFT_PIXEL_SIZE, 0, + } else if (XftPatternGetDouble(ftFont->pattern, XFT_PIXEL_SIZE, 0, &pxsize) == XftResultMatch) { - size = (double)-pxsize; + size = -pxsize; } else { size = 12.0; } -- cgit v0.12 From 9ed83f500d1ca3ece9d283b3c0eea519eb702bd4 Mon Sep 17 00:00:00 2001 From: fvogel Date: Thu, 16 May 2024 20:42:32 +0000 Subject: Reduce confusion by using the adequate variable name in GetTkFontAttributes(). --- unix/tkUnixRFont.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/unix/tkUnixRFont.c b/unix/tkUnixRFont.c index f3ab5c9..1103a38 100644 --- a/unix/tkUnixRFont.c +++ b/unix/tkUnixRFont.c @@ -189,8 +189,8 @@ GetTkFontAttributes( (void) XftPatternGetString(ftFont->pattern, XFT_FAMILY, 0, familyPtr); if (XftPatternGetDouble(ftFont->pattern, XFT_PIXEL_SIZE, 0, - &ptsize) == XftResultMatch) { - size = -ptsize; + &pxsize) == XftResultMatch) { + size = -pxsize; } else if (XftPatternGetDouble(ftFont->pattern, XFT_SIZE, 0, &ptsize) == XftResultMatch) { size = ptsize; -- cgit v0.12 From 77be6930f12a17f0cd6f1117ffb2008c1c658f46 Mon Sep 17 00:00:00 2001 From: fvogel Date: Fri, 17 May 2024 19:59:38 +0000 Subject: Backout [7edb8725]. Thanks, Jan! --- unix/tkUnixRFont.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/unix/tkUnixRFont.c b/unix/tkUnixRFont.c index 1103a38..13c3afe 100644 --- a/unix/tkUnixRFont.c +++ b/unix/tkUnixRFont.c @@ -184,8 +184,8 @@ GetTkFontAttributes( { const char *family = "Unknown"; const char *const *familyPtr = &family; - int weight, slant; - double size, ptsize, pxsize; + int weight, slant, pxsize; + double size, ptsize; (void) XftPatternGetString(ftFont->pattern, XFT_FAMILY, 0, familyPtr); if (XftPatternGetDouble(ftFont->pattern, XFT_PIXEL_SIZE, 0, @@ -194,9 +194,9 @@ GetTkFontAttributes( } else if (XftPatternGetDouble(ftFont->pattern, XFT_SIZE, 0, &ptsize) == XftResultMatch) { size = ptsize; - } else if (XftPatternGetDouble(ftFont->pattern, XFT_PIXEL_SIZE, 0, + } else if (XftPatternGetInteger(ftFont->pattern, XFT_PIXEL_SIZE, 0, &pxsize) == XftResultMatch) { - size = -pxsize; + size = (double)-pxsize; } else { size = 12.0; } -- cgit v0.12 From b6992940e251374984c8b33384da6412c75b376a Mon Sep 17 00:00:00 2001 From: fvogel Date: Fri, 17 May 2024 20:37:39 +0000 Subject: Revert [c03d4e79] --- unix/tkUnixRFont.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/unix/tkUnixRFont.c b/unix/tkUnixRFont.c index 13c3afe..baf9071 100644 --- a/unix/tkUnixRFont.c +++ b/unix/tkUnixRFont.c @@ -189,8 +189,8 @@ GetTkFontAttributes( (void) XftPatternGetString(ftFont->pattern, XFT_FAMILY, 0, familyPtr); if (XftPatternGetDouble(ftFont->pattern, XFT_PIXEL_SIZE, 0, - &pxsize) == XftResultMatch) { - size = -pxsize; + &ptsize) == XftResultMatch) { + size = -ptsize; } else if (XftPatternGetDouble(ftFont->pattern, XFT_SIZE, 0, &ptsize) == XftResultMatch) { size = ptsize; -- cgit v0.12 From eae51cd0e96ff84facbf0514040416714ba2292e Mon Sep 17 00:00:00 2001 From: fvogel Date: Fri, 17 May 2024 20:39:49 +0000 Subject: GetTkFontAttributes, Csaba's version (thanks!). --- unix/tkUnixRFont.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/unix/tkUnixRFont.c b/unix/tkUnixRFont.c index baf9071..2ca73e4 100644 --- a/unix/tkUnixRFont.c +++ b/unix/tkUnixRFont.c @@ -184,19 +184,19 @@ GetTkFontAttributes( { const char *family = "Unknown"; const char *const *familyPtr = &family; - int weight, slant, pxsize; - double size, ptsize; + double ptSize, dblPxSize, size; + int intPxSize, weight, slant; (void) XftPatternGetString(ftFont->pattern, XFT_FAMILY, 0, familyPtr); - if (XftPatternGetDouble(ftFont->pattern, XFT_PIXEL_SIZE, 0, - &ptsize) == XftResultMatch) { - size = -ptsize; - } else if (XftPatternGetDouble(ftFont->pattern, XFT_SIZE, 0, - &ptsize) == XftResultMatch) { - size = ptsize; + if (XftPatternGetDouble(ftFont->pattern, XFT_SIZE, 0, + &ptSize) == XftResultMatch) { + size = ptSize; + } else if (XftPatternGetDouble(ftFont->pattern, XFT_PIXEL_SIZE, 0, + &dblPxSize) == XftResultMatch) { + size = -dblPxSize; } else if (XftPatternGetInteger(ftFont->pattern, XFT_PIXEL_SIZE, 0, - &pxsize) == XftResultMatch) { - size = (double)-pxsize; + &intPxSize) == XftResultMatch) { + size = (double)-intPxSize; } else { size = 12.0; } @@ -215,7 +215,7 @@ GetTkFontAttributes( #endif /* DEBUG_FONTSEL */ faPtr->family = Tk_GetUid(family); - faPtr->size = TkFontGetPoints(tkwin, size); + faPtr->size = size; faPtr->weight = (weight > XFT_WEIGHT_MEDIUM) ? TK_FW_BOLD : TK_FW_NORMAL; faPtr->slant = (slant > XFT_SLANT_ROMAN) ? TK_FS_ITALIC : TK_FS_ROMAN; faPtr->underline = 0; -- cgit v0.12 From ce76659f66dcebb3e39805af376baddcc6dbe776 Mon Sep 17 00:00:00 2001 From: fvogel Date: Mon, 20 May 2024 14:58:43 +0000 Subject: Revert 3rd change from [84cd707d] following Csaba's request. --- unix/tkUnixRFont.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/unix/tkUnixRFont.c b/unix/tkUnixRFont.c index 2ca73e4..faca247 100644 --- a/unix/tkUnixRFont.c +++ b/unix/tkUnixRFont.c @@ -507,7 +507,7 @@ TkpGetFontFromAttributes( if (faPtr->size > 0.0) { XftPatternAddDouble(pattern, XFT_SIZE, faPtr->size); } else if (faPtr->size < 0.0) { - XftPatternAddDouble(pattern, XFT_PIXEL_SIZE, -faPtr->size); + XftPatternAddDouble(pattern, XFT_SIZE, TkFontGetPoints(tkwin, faPtr->size)); } else { XftPatternAddDouble(pattern, XFT_SIZE, 12.0); } -- cgit v0.12 From 256d91ca231e4922e41b452b886968c1455ffedb Mon Sep 17 00:00:00 2001 From: fvogel Date: Mon, 20 May 2024 15:14:01 +0000 Subject: Remove now useless tkwin argument of GetTkFontAttributes(). --- unix/tkUnixRFont.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/unix/tkUnixRFont.c b/unix/tkUnixRFont.c index faca247..5657dec 100644 --- a/unix/tkUnixRFont.c +++ b/unix/tkUnixRFont.c @@ -178,7 +178,6 @@ GetFont( static void GetTkFontAttributes( - Tk_Window tkwin, XftFont *ftFont, TkFontAttributes *faPtr) { @@ -351,7 +350,7 @@ InitFont( return NULL; } fontPtr->font.fid = XLoadFont(Tk_Display(tkwin), "fixed"); - GetTkFontAttributes(tkwin, ftFont, &fontPtr->font.fa); + GetTkFontAttributes(ftFont, &fontPtr->font.fa); GetTkFontMetrics(ftFont, &fontPtr->font.fm); Tk_DeleteErrorHandler(handler); if (errorFlag) { @@ -676,7 +675,7 @@ TkpGetSubFonts( void TkpGetFontAttrsForChar( - Tk_Window tkwin, /* Window on the font's display */ + TCL_UNUSED(Tk_Window), /* Window on the font's display */ Tk_Font tkfont, /* Font to query */ int c, /* Character of interest */ TkFontAttributes *faPtr) /* Output: Font attributes */ @@ -688,7 +687,7 @@ TkpGetFontAttrsForChar( XftFont *ftFont = GetFont(fontPtr, ucs4, 0.0); /* Actual font used to render the character */ - GetTkFontAttributes(tkwin, ftFont, faPtr); + GetTkFontAttributes(ftFont, faPtr); faPtr->underline = fontPtr->font.fa.underline; faPtr->overstrike = fontPtr->font.fa.overstrike; } -- cgit v0.12 From 89bd55dabcf8431554334caf5d157eaee64d030d Mon Sep 17 00:00:00 2001 From: fvogel Date: Mon, 20 May 2024 19:47:31 +0000 Subject: A bit better DEBUG_FONTSEL support. --- unix/tkUnixRFont.c | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/unix/tkUnixRFont.c b/unix/tkUnixRFont.c index 5657dec..378866a 100644 --- a/unix/tkUnixRFont.c +++ b/unix/tkUnixRFont.c @@ -15,6 +15,16 @@ #define MAX_CACHED_COLORS 16 +/* + * Debugging support... + */ + +#define DEBUG_FONTSEL 1 +#define DEBUG(arguments) \ + if (DEBUG_FONTSEL) { \ + printf arguments; fflush(stdout); \ + } + typedef struct { XftFont *ftFont; XftFont *ft0Font; @@ -208,10 +218,8 @@ GetTkFontAttributes( slant = XFT_SLANT_ROMAN; } -#ifdef DEBUG_FONTSEL - printf("family %s size %d weight %d slant %d\n", - family, (int)size, weight, slant); -#endif /* DEBUG_FONTSEL */ + DEBUG(("GetTkFontAttributes: family %s size %d weight %d slant %d\n", + family, (int)size, weight, slant)); faPtr->family = Tk_GetUid(family); faPtr->size = size; @@ -457,9 +465,8 @@ TkpGetNativeFont( { UnixFtFont *fontPtr; FcPattern *pattern; -#ifdef DEBUG_FONTSEL - printf("TkpGetNativeFont %s\n", name); -#endif /* DEBUG_FONTSEL */ + + DEBUG(("TkpGetNativeFont: %s\n", name)); pattern = XftXlfdParse(name, FcFalse, FcFalse); if (!pattern) { @@ -495,10 +502,9 @@ TkpGetFontFromAttributes( int weight, slant; UnixFtFont *fontPtr; -#ifdef DEBUG_FONTSEL - printf("TkpGetFontFromAttributes %s-%d %d %d\n", faPtr->family, - (int)faPtr->size, faPtr->weight, faPtr->slant); -#endif /* DEBUG_FONTSEL */ + DEBUG(("TkpGetFontFromAttributes: %s %d %d %d\n", faPtr->family, + (int)faPtr->size, faPtr->weight, faPtr->slant)); + pattern = XftPatternCreate(); if (faPtr->family) { XftPatternAddString(pattern, XFT_FAMILY, faPtr->family); @@ -803,7 +809,7 @@ measureCharsEnd: Tk_DeleteErrorHandler(handler); #ifdef DEBUG_FONTSEL string[len] = '\0'; - printf("MeasureChars %s length %d bytes %d\n", string, curX, curByte); + DEBUG(("MeasureChars: %s length %d bytes %d\n", string, curX, curByte)); #endif /* DEBUG_FONTSEL */ *lengthPtr = curX; return curByte; @@ -939,9 +945,7 @@ Tk_DrawChars( Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); if (fontPtr->ftDraw == 0) { -#ifdef DEBUG_FONTSEL - printf("Switch to drawable 0x%lx\n", drawable); -#endif /* DEBUG_FONTSEL */ + DEBUG(("Switch to drawable 0x%lx\n", drawable)); fontPtr->ftDraw = XftDrawCreate(display, drawable, DefaultVisual(display, fontPtr->screen), DefaultColormap(display, fontPtr->screen)); @@ -1080,9 +1084,7 @@ TkDrawAngledChars( int originX, originY; if (fontPtr->ftDraw == 0) { -#ifdef DEBUG_FONTSEL - printf("Switch to drawable 0x%x\n", drawable); -#endif /* DEBUG_FONTSEL */ + DEBUG(("Switch to drawable 0x%x\n", drawable)); fontPtr->ftDraw = XftDrawCreate(display, drawable, DefaultVisual(display, fontPtr->screen), DefaultColormap(display, fontPtr->screen)); @@ -1198,9 +1200,7 @@ TkDrawAngledChars( double sinA = sin(angle * PI/180.0), cosA = cos(angle * PI/180.0); if (fontPtr->ftDraw == 0) { -#ifdef DEBUG_FONTSEL - printf("Switch to drawable 0x%lx\n", drawable); -#endif /* DEBUG_FONTSEL */ + DEBUG(("Switch to drawable 0x%lx\n", drawable)); fontPtr->ftDraw = XftDrawCreate(display, drawable, DefaultVisual(display, fontPtr->screen), DefaultColormap(display, fontPtr->screen)); -- cgit v0.12 From 0bbb0bbbcd6cb4fd68effc30de72104b13d9bd42 Mon Sep 17 00:00:00 2001 From: fvogel Date: Sun, 26 May 2024 17:46:08 +0000 Subject: A few further improvements in tkUnixRFont.c by Csaba Nemethi. --- unix/tkUnixRFont.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/unix/tkUnixRFont.c b/unix/tkUnixRFont.c index 378866a..b687566 100644 --- a/unix/tkUnixRFont.c +++ b/unix/tkUnixRFont.c @@ -188,6 +188,7 @@ GetFont( static void GetTkFontAttributes( + Tk_Window tkwin, XftFont *ftFont, TkFontAttributes *faPtr) { @@ -218,11 +219,15 @@ GetTkFontAttributes( slant = XFT_SLANT_ROMAN; } - DEBUG(("GetTkFontAttributes: family %s size %d weight %d slant %d\n", - family, (int)size, weight, slant)); + DEBUG(("GetTkFontAttributes: family %s size %ld weight %d slant %d\n", + family, lround(size), weight, slant)); faPtr->family = Tk_GetUid(family); - faPtr->size = size; + /* + * Make sure that faPtr->size will be > 0 even + * in the very unprobable case that size < 0 + */ + faPtr->size = TkFontGetPoints(tkwin, size); faPtr->weight = (weight > XFT_WEIGHT_MEDIUM) ? TK_FW_BOLD : TK_FW_NORMAL; faPtr->slant = (slant > XFT_SLANT_ROMAN) ? TK_FS_ITALIC : TK_FS_ROMAN; faPtr->underline = 0; @@ -358,7 +363,7 @@ InitFont( return NULL; } fontPtr->font.fid = XLoadFont(Tk_Display(tkwin), "fixed"); - GetTkFontAttributes(ftFont, &fontPtr->font.fa); + GetTkFontAttributes(tkwin, ftFont, &fontPtr->font.fa); GetTkFontMetrics(ftFont, &fontPtr->font.fm); Tk_DeleteErrorHandler(handler); if (errorFlag) { @@ -502,8 +507,8 @@ TkpGetFontFromAttributes( int weight, slant; UnixFtFont *fontPtr; - DEBUG(("TkpGetFontFromAttributes: %s %d %d %d\n", faPtr->family, - (int)faPtr->size, faPtr->weight, faPtr->slant)); + DEBUG(("TkpGetFontFromAttributes: %s %ld %d %d\n", faPtr->family, + lround(faPtr->size), faPtr->weight, faPtr->slant)); pattern = XftPatternCreate(); if (faPtr->family) { @@ -681,7 +686,7 @@ TkpGetSubFonts( void TkpGetFontAttrsForChar( - TCL_UNUSED(Tk_Window), /* Window on the font's display */ + Tk_Window tkwin, /* Window on the font's display */ Tk_Font tkfont, /* Font to query */ int c, /* Character of interest */ TkFontAttributes *faPtr) /* Output: Font attributes */ @@ -693,7 +698,7 @@ TkpGetFontAttrsForChar( XftFont *ftFont = GetFont(fontPtr, ucs4, 0.0); /* Actual font used to render the character */ - GetTkFontAttributes(ftFont, faPtr); + GetTkFontAttributes(tkwin, ftFont, faPtr); faPtr->underline = fontPtr->font.fa.underline; faPtr->overstrike = fontPtr->font.fa.overstrike; } -- cgit v0.12 From 51020718f10fb554cc027d63c5a0c38269497324 Mon Sep 17 00:00:00 2001 From: fvogel Date: Sun, 26 May 2024 17:54:02 +0000 Subject: Restore old version of font-44.1, following Csaba's suggestion, but add a pointer to the relevant ticket in case it failed again in the future. --- tests/font.test | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/tests/font.test b/tests/font.test index 98c1112..bdaba30 100644 --- a/tests/font.test +++ b/tests/font.test @@ -2347,15 +2347,11 @@ test font-43.1 {FieldSpecified procedure: specified vs. non-specified} -body { } -result [font actual {times 0} -family] -test font-44.1 {TkFontGetPixels: size < 0} -setup { - set oldscale [tk scaling] -} -body { - set oldsize [expr {-(-12.0 / $oldscale)}] +test font-44.1 {TkFontGetPixels: size < 0} -body { + # if this test failed, start the investigations by reading ticket [8162e9b7a9] tk scaling 0.5 - expr {round([font actual {times -12} -size] / $oldscale * 0.5) - round($oldsize) == 0} -} -cleanup { - tk scaling $oldscale -} -result 1 + font actual {times -11} -size +} -result 22 test font-44.2 {TkFontGetPoints: size >= 0} -constraints {noExceed haveTimes12Font} -setup { set oldscale [tk scaling] } -body { -- cgit v0.12 From 729cd7729f8a5b5290076907781b39720da9d938 Mon Sep 17 00:00:00 2001 From: fvogel Date: Sun, 26 May 2024 19:22:52 +0000 Subject: #define DEBUG_FONTSEL 0 --- unix/tkUnixRFont.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/unix/tkUnixRFont.c b/unix/tkUnixRFont.c index b687566..55d0eb8 100644 --- a/unix/tkUnixRFont.c +++ b/unix/tkUnixRFont.c @@ -19,7 +19,7 @@ * Debugging support... */ -#define DEBUG_FONTSEL 1 +#define DEBUG_FONTSEL 0 #define DEBUG(arguments) \ if (DEBUG_FONTSEL) { \ printf arguments; fflush(stdout); \ -- cgit v0.12 From 340f961ba19b94eb6646bcbf8859350e8d8a9eef Mon Sep 17 00:00:00 2001 From: fvogel Date: Mon, 27 May 2024 20:12:49 +0000 Subject: Let this bugfix branch build and test at Github Actions. --- .github/workflows/linux-build.yml | 1 + .github/workflows/mac-build.yml | 1 + .github/workflows/win-build.yml | 1 + 3 files changed, 3 insertions(+) diff --git a/.github/workflows/linux-build.yml b/.github/workflows/linux-build.yml index 9414037..042e436 100644 --- a/.github/workflows/linux-build.yml +++ b/.github/workflows/linux-build.yml @@ -5,6 +5,7 @@ on: - "main" - "core-8-branch" - "core-8-6-branch" + - "bug-8162e9b7a9" tags: - "core-**" permissions: diff --git a/.github/workflows/mac-build.yml b/.github/workflows/mac-build.yml index 9fd297a..5a871e6 100644 --- a/.github/workflows/mac-build.yml +++ b/.github/workflows/mac-build.yml @@ -5,6 +5,7 @@ on: - "main" - "core-8-branch" - "core-8-6-branch" + - "bug-8162e9b7a9" tags: - "core-**" permissions: diff --git a/.github/workflows/win-build.yml b/.github/workflows/win-build.yml index 6642a8d..d84abb6 100644 --- a/.github/workflows/win-build.yml +++ b/.github/workflows/win-build.yml @@ -5,6 +5,7 @@ on: - "main" - "core-8-branch" - "core-8-6-branch" + - "bug-8162e9b7a9" tags: - "core-**" permissions: -- cgit v0.12 From 2ef75878f15c08a4bbcf76495a1a15e9997ceb9f Mon Sep 17 00:00:00 2001 From: fvogel Date: Tue, 28 May 2024 19:08:25 +0000 Subject: Save and restore current scaling when running font-44.1 (this prevents several other tests in other test files from failing). --- tests/font.test | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/font.test b/tests/font.test index bdaba30..33d0f7b 100644 --- a/tests/font.test +++ b/tests/font.test @@ -2347,10 +2347,14 @@ test font-43.1 {FieldSpecified procedure: specified vs. non-specified} -body { } -result [font actual {times 0} -family] -test font-44.1 {TkFontGetPixels: size < 0} -body { +test font-44.1 {TkFontGetPixels: size < 0} -setup { + set oldscale [tk scaling] +} -body { # if this test failed, start the investigations by reading ticket [8162e9b7a9] tk scaling 0.5 font actual {times -11} -size +} -cleanup { + tk scaling $oldscale } -result 22 test font-44.2 {TkFontGetPoints: size >= 0} -constraints {noExceed haveTimes12Font} -setup { set oldscale [tk scaling] -- cgit v0.12 From 01d6c531757925d6ce44532bc029d9e84f022c0d Mon Sep 17 00:00:00 2001 From: fvogel Date: Tue, 28 May 2024 19:30:06 +0000 Subject: #ifdef DEBUG_FONTSEL --> #if DEBUG_FONTSEL in tkUnixRFont.c --- unix/tkUnixRFont.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/unix/tkUnixRFont.c b/unix/tkUnixRFont.c index 55d0eb8..2a3ecef 100644 --- a/unix/tkUnixRFont.c +++ b/unix/tkUnixRFont.c @@ -733,7 +733,7 @@ Tk_MeasureChars( int clen, curX, newX, curByte, newByte, sawNonSpace; int termByte = 0, termX = 0, errorFlag = 0; Tk_ErrorHandler handler; -#ifdef DEBUG_FONTSEL +#if DEBUG_FONTSEL char string[256]; int len = 0; #endif /* DEBUG_FONTSEL */ @@ -769,7 +769,7 @@ Tk_MeasureChars( sawNonSpace = 1; } -#ifdef DEBUG_FONTSEL +#if DEBUG_FONTSEL string[len++] = (char) c; #endif /* DEBUG_FONTSEL */ ftFont = GetFont(fontPtr, c, 0.0); @@ -812,7 +812,7 @@ Tk_MeasureChars( } measureCharsEnd: Tk_DeleteErrorHandler(handler); -#ifdef DEBUG_FONTSEL +#if DEBUG_FONTSEL string[len] = '\0'; DEBUG(("MeasureChars: %s length %d bytes %d\n", string, curX, curByte)); #endif /* DEBUG_FONTSEL */ -- cgit v0.12 From 326b290a21369113203576878050cc4c20e25d4c Mon Sep 17 00:00:00 2001 From: fvogel Date: Tue, 28 May 2024 21:22:00 +0000 Subject: Request font with pixel size 13 instead of 11, so that font-44.1 passes without Xft under xvfb too. --- tests/font.test | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/font.test b/tests/font.test index 33d0f7b..37132ad 100644 --- a/tests/font.test +++ b/tests/font.test @@ -2352,10 +2352,10 @@ test font-44.1 {TkFontGetPixels: size < 0} -setup { } -body { # if this test failed, start the investigations by reading ticket [8162e9b7a9] tk scaling 0.5 - font actual {times -11} -size + font actual {times -13} -size } -cleanup { tk scaling $oldscale -} -result 22 +} -result 26 test font-44.2 {TkFontGetPoints: size >= 0} -constraints {noExceed haveTimes12Font} -setup { set oldscale [tk scaling] } -body { -- cgit v0.12