diff options
author | fvogel <fvogelnew1@free.fr> | 2024-05-17 20:39:49 (GMT) |
---|---|---|
committer | fvogel <fvogelnew1@free.fr> | 2024-05-17 20:39:49 (GMT) |
commit | eae51cd0e96ff84facbf0514040416714ba2292e (patch) | |
tree | 454ff0677ce7b34a1a64e432b4fa5541a6cdc378 | |
parent | b6992940e251374984c8b33384da6412c75b376a (diff) | |
download | tk-eae51cd0e96ff84facbf0514040416714ba2292e.zip tk-eae51cd0e96ff84facbf0514040416714ba2292e.tar.gz tk-eae51cd0e96ff84facbf0514040416714ba2292e.tar.bz2 |
GetTkFontAttributes, Csaba's version (thanks!).
-rw-r--r-- | unix/tkUnixRFont.c | 22 |
1 files 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; |