summaryrefslogtreecommitdiffstats
path: root/unix
diff options
context:
space:
mode:
authorfvogel <fvogelnew1@free.fr>2023-10-29 21:00:32 (GMT)
committerfvogel <fvogelnew1@free.fr>2023-10-29 21:00:32 (GMT)
commitf64d07b592ecb66269eb4dfadf2c0ad0ae6b1572 (patch)
treec675c5164619dbb90dc9c594ecfd72d15e489a98 /unix
parent175bd29fa30803f63c3346585344a9f35b63dd17 (diff)
downloadtk-f64d07b592ecb66269eb4dfadf2c0ad0ae6b1572.zip
tk-f64d07b592ecb66269eb4dfadf2c0ad0ae6b1572.tar.gz
tk-f64d07b592ecb66269eb4dfadf2c0ad0ae6b1572.tar.bz2
Fix [61550f38bf]: font actual returns wrong font size with Xft.
Diffstat (limited to 'unix')
-rw-r--r--unix/tkUnixRFont.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/unix/tkUnixRFont.c b/unix/tkUnixRFont.c
index a295173..dee9abc 100644
--- a/unix/tkUnixRFont.c
+++ b/unix/tkUnixRFont.c
@@ -178,6 +178,7 @@ GetFont(
static void
GetTkFontAttributes(
+ Tk_Window tkwin,
XftFont *ftFont,
TkFontAttributes *faPtr)
{
@@ -187,12 +188,12 @@ GetTkFontAttributes(
double size, ptsize;
(void) XftPatternGetString(ftFont->pattern, XFT_FAMILY, 0, familyPtr);
- if (XftPatternGetDouble(ftFont->pattern, XFT_SIZE, 0,
- &ptsize) == XftResultMatch) {
- size = ptsize;
- } else if (XftPatternGetDouble(ftFont->pattern, XFT_PIXEL_SIZE, 0,
+ if (XftPatternGetDouble(ftFont->pattern, XFT_PIXEL_SIZE, 0,
&ptsize) == XftResultMatch) {
size = -ptsize;
+ } else if (XftPatternGetDouble(ftFont->pattern, XFT_SIZE, 0,
+ &ptsize) == XftResultMatch) {
+ size = ptsize;
} else if (XftPatternGetInteger(ftFont->pattern, XFT_PIXEL_SIZE, 0,
&pxsize) == XftResultMatch) {
size = (double)-pxsize;
@@ -214,7 +215,7 @@ GetTkFontAttributes(
#endif /* DEBUG_FONTSEL */
faPtr->family = Tk_GetUid(family);
- faPtr->size = size;
+ 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;
@@ -350,7 +351,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) {
@@ -675,7 +676,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 */
@@ -687,7 +688,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;
}