Skip to content

Commit

Permalink
Backout [6f485577] since it triggers an unexpected failure in the mai…
Browse files Browse the repository at this point in the history
…n branch.
  • Loading branch information
fvogelnew1 committed Nov 6, 2023
1 parent 0fd2c73 commit ad68137
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
2 changes: 1 addition & 1 deletion tests/font.test
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
19 changes: 9 additions & 10 deletions unix/tkUnixRFont.c
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,6 @@ GetFont(

static void
GetTkFontAttributes(
Tk_Window tkwin,
XftFont *ftFont,
TkFontAttributes *faPtr)
{
Expand All @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -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 */
Expand All @@ -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;
}
Expand Down

0 comments on commit ad68137

Please sign in to comment.