diff options
-rw-r--r-- | .github/workflows/linux-build.yml | 1 | ||||
-rw-r--r-- | .github/workflows/mac-build.yml | 1 | ||||
-rw-r--r-- | .github/workflows/win-build.yml | 1 | ||||
-rw-r--r-- | generic/tkTextBTree.c | 16 | ||||
-rw-r--r-- | tests/font.test | 2 | ||||
-rw-r--r-- | unix/tkUnixRFont.c | 19 |
6 files changed, 22 insertions, 18 deletions
diff --git a/.github/workflows/linux-build.yml b/.github/workflows/linux-build.yml index d332349..d594c0c 100644 --- a/.github/workflows/linux-build.yml +++ b/.github/workflows/linux-build.yml @@ -4,7 +4,6 @@ on: branches: - "main" - "core-8-6-branch" - - "bug-61550f38bf" tags: - "core-**" permissions: diff --git a/.github/workflows/mac-build.yml b/.github/workflows/mac-build.yml index 0698ea9..6c06a55 100644 --- a/.github/workflows/mac-build.yml +++ b/.github/workflows/mac-build.yml @@ -4,7 +4,6 @@ on: branches: - "main" - "core-8-6-branch" - - "bug-61550f38bf" tags: - "core-**" permissions: diff --git a/.github/workflows/win-build.yml b/.github/workflows/win-build.yml index a8ee77b..75f3a99 100644 --- a/.github/workflows/win-build.yml +++ b/.github/workflows/win-build.yml @@ -4,7 +4,6 @@ on: branches: - "main" - "core-8-6-branch" - - "bug-61550f38bf" tags: - "core-**" permissions: diff --git a/generic/tkTextBTree.c b/generic/tkTextBTree.c index 533f1bf..1c9cc98 100644 --- a/generic/tkTextBTree.c +++ b/generic/tkTextBTree.c @@ -632,10 +632,18 @@ AdjustStartEndRefs( i++; } treePtr->startEndCount = count; - treePtr->startEnd = (TkTextLine **)ckrealloc(treePtr->startEnd, - sizeof(TkTextLine *) * count); - treePtr->startEndRef = (TkText **)ckrealloc(treePtr->startEndRef, - sizeof(TkText *) * count); + if (count > 0) { + treePtr->startEnd = (TkTextLine**)ckrealloc(treePtr->startEnd, + sizeof(TkTextLine*) * count); + treePtr->startEndRef = (TkText**)ckrealloc(treePtr->startEndRef, + sizeof(TkText*) * count); + } + else { + ckfree(treePtr->startEndRef); + treePtr->startEndRef = NULL; + ckfree(treePtr->startEnd); + treePtr->startEnd = NULL; + } } if ((action & TEXT_ADD_REFS) && (textPtr->start != NULL || textPtr->end != NULL)) { diff --git a/tests/font.test b/tests/font.test index f112d16..69d3b15 100644 --- a/tests/font.test +++ b/tests/font.test @@ -2339,7 +2339,7 @@ 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 { +test font-44.1 {TkFontGetPixels: size < 0} -constraints failsOnUbuntu -setup { set oldscale [tk scaling] } -body { tk scaling 0.5 diff --git a/unix/tkUnixRFont.c b/unix/tkUnixRFont.c index 2c017e2..a295173 100644 --- a/unix/tkUnixRFont.c +++ b/unix/tkUnixRFont.c @@ -178,7 +178,6 @@ GetFont( static void GetTkFontAttributes( - Tk_Window tkwin, XftFont *ftFont, TkFontAttributes *faPtr) { @@ -188,12 +187,12 @@ GetTkFontAttributes( double size, ptsize; (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, + if (XftPatternGetDouble(ftFont->pattern, XFT_SIZE, 0, &ptsize) == XftResultMatch) { size = ptsize; + } else if (XftPatternGetDouble(ftFont->pattern, XFT_PIXEL_SIZE, 0, + &ptsize) == XftResultMatch) { + size = -ptsize; } else if (XftPatternGetInteger(ftFont->pattern, XFT_PIXEL_SIZE, 0, &pxsize) == XftResultMatch) { size = (double)-pxsize; @@ -215,7 +214,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; @@ -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) { @@ -507,7 +506,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); } @@ -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; } |