Skip to content

Commit ad68137

Browse files
committed
Backout [6f485577] since it triggers an unexpected failure in the main branch.
1 parent 0fd2c73 commit ad68137

File tree

2 files changed

+10
-11
lines changed

2 files changed

+10
-11
lines changed

tests/font.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2339,7 +2339,7 @@ test font-43.1 {FieldSpecified procedure: specified vs. non-specified} -body {
23392339
} -result [font actual {times 0} -family]
23402340

23412341

2342-
test font-44.1 {TkFontGetPixels: size < 0} -setup {
2342+
test font-44.1 {TkFontGetPixels: size < 0} -constraints failsOnUbuntu -setup {
23432343
set oldscale [tk scaling]
23442344
} -body {
23452345
tk scaling 0.5

unix/tkUnixRFont.c

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,6 @@ GetFont(
178178

179179
static void
180180
GetTkFontAttributes(
181-
Tk_Window tkwin,
182181
XftFont *ftFont,
183182
TkFontAttributes *faPtr)
184183
{
@@ -188,12 +187,12 @@ GetTkFontAttributes(
188187
double size, ptsize;
189188

190189
(void) XftPatternGetString(ftFont->pattern, XFT_FAMILY, 0, familyPtr);
191-
if (XftPatternGetDouble(ftFont->pattern, XFT_PIXEL_SIZE, 0,
192-
&ptsize) == XftResultMatch) {
193-
size = -ptsize;
194-
} else if (XftPatternGetDouble(ftFont->pattern, XFT_SIZE, 0,
190+
if (XftPatternGetDouble(ftFont->pattern, XFT_SIZE, 0,
195191
&ptsize) == XftResultMatch) {
196192
size = ptsize;
193+
} else if (XftPatternGetDouble(ftFont->pattern, XFT_PIXEL_SIZE, 0,
194+
&ptsize) == XftResultMatch) {
195+
size = -ptsize;
197196
} else if (XftPatternGetInteger(ftFont->pattern, XFT_PIXEL_SIZE, 0,
198197
&pxsize) == XftResultMatch) {
199198
size = (double)-pxsize;
@@ -215,7 +214,7 @@ GetTkFontAttributes(
215214
#endif /* DEBUG_FONTSEL */
216215

217216
faPtr->family = Tk_GetUid(family);
218-
faPtr->size = TkFontGetPoints(tkwin, size);
217+
faPtr->size = size;
219218
faPtr->weight = (weight > XFT_WEIGHT_MEDIUM) ? TK_FW_BOLD : TK_FW_NORMAL;
220219
faPtr->slant = (slant > XFT_SLANT_ROMAN) ? TK_FS_ITALIC : TK_FS_ROMAN;
221220
faPtr->underline = 0;
@@ -351,7 +350,7 @@ InitFont(
351350
return NULL;
352351
}
353352
fontPtr->font.fid = XLoadFont(Tk_Display(tkwin), "fixed");
354-
GetTkFontAttributes(tkwin, ftFont, &fontPtr->font.fa);
353+
GetTkFontAttributes(ftFont, &fontPtr->font.fa);
355354
GetTkFontMetrics(ftFont, &fontPtr->font.fm);
356355
Tk_DeleteErrorHandler(handler);
357356
if (errorFlag) {
@@ -507,7 +506,7 @@ TkpGetFontFromAttributes(
507506
if (faPtr->size > 0.0) {
508507
XftPatternAddDouble(pattern, XFT_SIZE, faPtr->size);
509508
} else if (faPtr->size < 0.0) {
510-
XftPatternAddDouble(pattern, XFT_PIXEL_SIZE, -faPtr->size);
509+
XftPatternAddDouble(pattern, XFT_SIZE, TkFontGetPoints(tkwin, faPtr->size));
511510
} else {
512511
XftPatternAddDouble(pattern, XFT_SIZE, 12.0);
513512
}
@@ -676,7 +675,7 @@ TkpGetSubFonts(
676675

677676
void
678677
TkpGetFontAttrsForChar(
679-
Tk_Window tkwin, /* Window on the font's display */
678+
TCL_UNUSED(Tk_Window), /* Window on the font's display */
680679
Tk_Font tkfont, /* Font to query */
681680
int c, /* Character of interest */
682681
TkFontAttributes *faPtr) /* Output: Font attributes */
@@ -688,7 +687,7 @@ TkpGetFontAttrsForChar(
688687
XftFont *ftFont = GetFont(fontPtr, ucs4, 0.0);
689688
/* Actual font used to render the character */
690689

691-
GetTkFontAttributes(tkwin, ftFont, faPtr);
690+
GetTkFontAttributes(ftFont, faPtr);
692691
faPtr->underline = fontPtr->font.fa.underline;
693692
faPtr->overstrike = fontPtr->font.fa.overstrike;
694693
}

0 commit comments

Comments
 (0)